package cn.com.taiji.oospub.wechat.common;

import cn.com.taiji.oospub.wechat.common.tool.TimeTools;
import cn.com.taiji.oospub.wechat.entity.CoursesOrders;
import cn.com.taiji.oospub.wechat.entity.CoursesOrdersDetails;
import cn.com.taiji.oospub.wechat.entity.MemberBaseInfo;
import cn.com.taiji.oospub.wechat.entity.OrderOfDaynut;
import cn.com.taiji.oospub.wechat.model.CardConsumptionModel;
import cn.com.taiji.oospub.wechat.model.CardStoredModel;
import cn.com.taiji.oospub.wechat.model.MemberBaseInfoModel;
import cn.com.taiji.pub.StringTools;
import cn.hutool.core.date.LocalDateTimeUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.time.LocalDateTime;
import java.util.*;

import static java.net.URLEncoder.encode;

public class ObjectToXML {
    public ObjectToXML() {

    }

    public Map<String, String> resCodeMap;//账户查询描述列表

    public ObjectToXML(Map<String, String> resCodeMap) {
        this.resCodeMap = resCodeMap;

    }

    /*餐卡余额查询 储值卡
     * @param password
     * @param project_code
     * @param cupassword
     * @param uuid
     * @return
     */
    public String requestAccountXML(String password, String request_cus, String project_code, String customer_no, String cupassword, String uuid) {

        String requestAccountXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestAccountXml += "<ARAMARK_REQUEST>";
        requestAccountXml += "<HEAD>";
        requestAccountXml += "<VERSION>1.0</VERSION>";
        requestAccountXml += "<PASSWORD>" + password + "</PASSWORD>";
        requestAccountXml += "<REQUEST_CUS>" + request_cus + "</REQUEST_CUS>";
        requestAccountXml += "<REQUEST_TYPE>KONGXC_AC001</REQUEST_TYPE>";
        requestAccountXml += "<PROJECT_CODE>" + project_code + "</PROJECT_CODE>";
        requestAccountXml += "<REQUEST_UNIQUE>" + uuid + "</REQUEST_UNIQUE>";
        requestAccountXml += "<REQUEST_CONDITION>";
        requestAccountXml += "<CUSTOMER_NO>" + customer_no + "</CUSTOMER_NO>";
        requestAccountXml += "<CUSTOMER_ACCOUNT_TYPE>04</CUSTOMER_ACCOUNT_TYPE>";
        requestAccountXml += "<CUPASSWORD>" + cupassword + "</CUPASSWORD>";
        requestAccountXml += "</REQUEST_CONDITION>";
        requestAccountXml += "</HEAD>";
        requestAccountXml += "</ARAMARK_REQUEST>";

        return requestAccountXml;
    }

    //
//
//
///**
// * 餐卡余额查询（查询某种[补助卡、储值卡]）
// * @param password
// * @param project_code
// * @param cupassword
// * @param uuid
// * @return
// *
// * <ARAMARK_REQUEST>
// *  	<HEAD>
// *  		<VERSION></VERSION>
// *  		<PASSWORD></PASSWORD>
// * 			<REQUEST_CUS></REQUEST_CUS>
// *  		<REQUEST_TYPE>KONGXC_AC001</REQUEST_TYPE>
// *  		<PROJECT_CODE></PROJECT_CODE>
// *  		<REQUEST_UNIQUE></REQUEST_UNIQUE>
// * 			<REQUEST_CONDITION>
// *  			<CUSTOMER_NO></CUSTOMER_NO>
// *  			<CUSTOMER_ACCOUNT_TYPE></CUSTOMER_ACCOUNT_TYPE>
// * 				<CUPASSWORD></CUPASSWORD>
// * 			</REQUEST_CONDITION>
// * 		</HEAD>
// * </ARAMARK_REQUEST>
// *
// */
    public String requestAccountXMLKongxc(String password, String proName, String project_code, String idNumber, String cupassword, String uuid, String chuzhika_num) {

        String requestAccountXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestAccountXml += "<ARAMARK_REQUEST>";
        requestAccountXml += "<HEAD>";
        requestAccountXml += "<VERSION>1.0</VERSION>";
        requestAccountXml += "<PASSWORD>" + password + "</PASSWORD>";
        requestAccountXml += "<REQUEST_CUS>" + proName + "</REQUEST_CUS>";
        requestAccountXml += "<REQUEST_TYPE>KONGXC_AC001</REQUEST_TYPE>";
        requestAccountXml += "<PROJECT_CODE>" + project_code + "</PROJECT_CODE>";
        requestAccountXml += "<REQUEST_UNIQUE>" + uuid + "</REQUEST_UNIQUE>";
        requestAccountXml += "<REQUEST_CONDITION>";
        requestAccountXml += "<CUSTOMER_NO>" + idNumber + "</CUSTOMER_NO>";
        requestAccountXml += "<CUSTOMER_ACCOUNT_TYPE>" + chuzhika_num + "</CUSTOMER_ACCOUNT_TYPE>";
        requestAccountXml += "<CUPASSWORD>" + cupassword + "</CUPASSWORD>";
        requestAccountXml += "</REQUEST_CONDITION>";
        requestAccountXml += "</HEAD>";
        requestAccountXml += "</ARAMARK_REQUEST>";

        return requestAccountXml;
    }


    /**
     * 查询用户所有的餐卡
     *
     * @param password
     * @param cupassword
     * @param uuid
     * @return <ARAMARK_REQUEST>
     * <HEAD>
     * <VERSION></VERSION>
     * <PASSWORD></PASSWORD>
     * <REQUEST_CUS></REQUEST_CUS>
     * <REQUEST_TYPE>ACCOUNT_TRADE</REQUEST_TYPE>
     * <PROJECT_CODE></PROJECT_CODE>
     * <REQUEST_UNIQUE></REQUEST_UNIQUE>
     * </HEAD>
     * <BODY>
     * <CUSTOMER_NO></CUSTOMER_NO>
     * <CUSTOMER_PWD></CUSTOMER_PWD>
     * </BODY>
     * </ARAMARK_REQUEST>
     */
    public String requestAccountAllXMLKongxc(String password, String proName, String projectCode, String idNumber, String cupassword, String uuid) {

        String requestAccountXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestAccountXml += "<ARAMARK_REQUEST>";
        requestAccountXml += "<HEAD>";
        requestAccountXml += "<VERSION>1.0</VERSION>";
        requestAccountXml += "<PASSWORD>" + password + "</PASSWORD>";
        requestAccountXml += "<REQUEST_CUS>" + proName + "</REQUEST_CUS>";
        requestAccountXml += "<REQUEST_TYPE>ACCOUNT_ALL</REQUEST_TYPE>";
        requestAccountXml += "<PROJECT_CODE>" + projectCode + "</PROJECT_CODE>";
        requestAccountXml += "<REQUEST_UNIQUE>" + uuid + "</REQUEST_UNIQUE>";
        requestAccountXml += "</HEAD>";
        requestAccountXml += "<BODY>";
        requestAccountXml += "<CUSTOMER_NO>" + idNumber + "</CUSTOMER_NO>";
        requestAccountXml += "<CUSTOMER_PWD>" + cupassword + "</CUSTOMER_PWD>";
        requestAccountXml += "</BODY>";
        requestAccountXml += "</ARAMARK_REQUEST>";

        return requestAccountXml;
    }


    /**
     * 到pos查询消费记录
     *
     * @param PASSWORD
     * @param REQUEST_CUS
     * @param PROJECT_CODE
     * @param CUSTOMER_NO
     * @param CUPASSWORD
     * @param SER_TIME
     * @param uuid
     * @return
     */
    public String requestConsumptionRecord(String PASSWORD, String REQUEST_CUS, String PROJECT_CODE, String CUSTOMER_NO, String CUPASSWORD, String SER_TIME, String END_TIME, String uuid) {

        String requestRecordXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRecordXml += "<ARAMARK_REQUEST>";
        requestRecordXml += "<HEAD>";
        requestRecordXml += "<VERSION>1.0</VERSION>";
        requestRecordXml += "<PASSWORD>" + PASSWORD + "</PASSWORD>";
        requestRecordXml += "<REQUEST_CUS>" + REQUEST_CUS + "</REQUEST_CUS>";
        requestRecordXml += "<REQUEST_TYPE>CR001</REQUEST_TYPE>";
        requestRecordXml += "<PROJECT_CODE>" + PROJECT_CODE + "</PROJECT_CODE>";
        requestRecordXml += "<REQUEST_UNIQUE>" + uuid + "</REQUEST_UNIQUE>";
        requestRecordXml += "<REQUEST_CONDITION>";
        requestRecordXml += "<CUSTOMER_NO>" + CUSTOMER_NO + "</CUSTOMER_NO>";
        requestRecordXml += "<CUPASSWORD>" + CUPASSWORD + "</CUPASSWORD>";
        requestRecordXml += "<SER_TIME>" + SER_TIME + "</SER_TIME>"; //时间格式  YYYY-MM-DD
        requestRecordXml += "<END_TIME>" + END_TIME + "</END_TIME>"; //时间格式  YYYY-MM-DD
        requestRecordXml += "</REQUEST_CONDITION>";
        requestRecordXml += "</HEAD>";
        requestRecordXml += "</ARAMARK_REQUEST>";
        return requestRecordXml;
    }


    /**
     * 到pos查询储值记录
     *
     * @param password
     * @param request_cus
     * @param project_code
     * @param customer_no
     * @param cupassword
     * @param SER_TIME
     * @param uuid
     * @return //
     */
    public String requestStoredXML(String password, String request_cus, String project_code, String customer_no, String cupassword, String uuid, String SER_TIME, String END_TIME) {

        String requestStoredXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestStoredXML += "<ARAMARK_REQUEST>";
        requestStoredXML += "<HEAD>";
        requestStoredXML += "<VERSION>1.0</VERSION>";
        requestStoredXML += "<PASSWORD>" + password + "</PASSWORD>";
        requestStoredXML += "<REQUEST_CUS>" + request_cus + "</REQUEST_CUS>";
        requestStoredXML += "<REQUEST_TYPE>QST002</REQUEST_TYPE>";
        requestStoredXML += "<PROJECT_CODE>" + project_code + "</PROJECT_CODE>";
        requestStoredXML += "<REQUEST_UNIQUE>" + uuid + "</REQUEST_UNIQUE>";
        requestStoredXML += "<REQUEST_CONDITION>";
        requestStoredXML += "<CUSTOMER_NO>" + customer_no + "</CUSTOMER_NO>";
        requestStoredXML += "<CUPASSWORD>" + cupassword + "</CUPASSWORD>";
        requestStoredXML += "<SER_TIME>" + SER_TIME + "</SER_TIME> "; // 查询日期节点不存在   查询日期不能为空  日期格式错误
        requestStoredXML += "<END_TIME>" + END_TIME + "</END_TIME> ";
        requestStoredXML += "</REQUEST_CONDITION>";
        requestStoredXML += "</HEAD>";
        requestStoredXML += "</ARAMARK_REQUEST>";
        return requestStoredXML;
    }

    /**
     * 储值请求
     *
     * @param password
     * @param proName
     * @param projectCode
     * @param accNo
     * @param cupassword
     * @param uuid
     * @return <ARAMARK_REQUEST>
     * <HEAD>
     * <VERSION></VERSION>
     * <PASSWORD></PASSWORD>
     * <REQUEST_CUS></REQUEST_CUS>
     * <REQUEST_TYPE>ACCOUNT_POSPAY_RECHARGE</REQUEST_TYPE>
     * <PROJECT_CODE></PROJECT_CODE>
     * <REQUEST_UNIQUE></REQUEST_UNIQUE>
     * </HEAD>
     * <BODY>
     * <CUSTOMER_NO></CUSTOMER_NO>
     * <CUSTOMER_PWD></CUSTOMER_PWD>
     * <CUSTOMER_EMAIL></CUSTOMER_EMAIL>
     * <IS_BINDING></IS_BINDING>
     * <ACCOUNT_NO></ACCOUNT_NO>
     * <AMOUNT></AMOUNT>
     * <PAGE_SIZE></PAGE_SIZE>
     * <PAGE_INDEX></PAGE_INDEX>
     * </BODY>
     * </ARAMARK_REQUEST>
     */
    public String requestRecharge(String password, String proName, String projectCode, String uuid,
                                  String idNumber, String cupassword, String email, String isBinDing, String accNo, Double amount, String weChatCode, String pageSize, String pageIndex) {
        String requestAccountXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestAccountXml += "<ARAMARK_REQUEST>";
        requestAccountXml += "<HEAD>";
        requestAccountXml += "<VERSION>1.0</VERSION>";
        requestAccountXml += "<PASSWORD>" + password + "</PASSWORD>";
        requestAccountXml += "<REQUEST_CUS>" + proName + "</REQUEST_CUS>";
        requestAccountXml += "<REQUEST_TYPE>ACCOUNT_POSPAY_RECHARGE</REQUEST_TYPE>";
        requestAccountXml += "<PROJECT_CODE>" + projectCode + "</PROJECT_CODE>";
        requestAccountXml += "<REQUEST_UNIQUE>" + uuid + "</REQUEST_UNIQUE>";
        requestAccountXml += "</HEAD>";
        requestAccountXml += "<BODY>";
        requestAccountXml += "<CUSTOMER_NO>" + idNumber + "</CUSTOMER_NO>";
        requestAccountXml += "<CUSTOMER_PWD>" + cupassword + "</CUSTOMER_PWD>";

        if (StringUtils.isEmpty(email)) {
            requestAccountXml += "<CUSTOMER_EMAIL>none</CUSTOMER_EMAIL>";
        } else {
            requestAccountXml += "<CUSTOMER_EMAIL>" + email + "</CUSTOMER_EMAIL>";
        }
        requestAccountXml += "<IS_BINDING>" + isBinDing + "</IS_BINDING>";
        requestAccountXml += "<ACCOUNT_NO>" + accNo + "</ACCOUNT_NO>";
        requestAccountXml += "<AMOUNT>" + amount + "</AMOUNT>";
        requestAccountXml += "<WECHATCODE>" + weChatCode + "</WECHATCODE>";
        requestAccountXml += "<PAGE_SIZE>" + pageSize + "</PAGE_SIZE>";
        requestAccountXml += "<PAGE_INDEX>" + pageIndex + "</PAGE_INDEX>";
        requestAccountXml += "</BODY>";
        requestAccountXml += "</ARAMARK_REQUEST>";

        return requestAccountXml;
    }

    /**
     * 验证请求响应的已绑定餐卡
     */

    public Map<String, String> resResXmlAccCharge(String requestAccountXml) {
        resCodeMap.put("resCode", "0000");
        try {
            Document doc = DocumentHelper.parseText(requestAccountXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                resCodeMap.put("resCode", "0002");
                return resCodeMap;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    resCodeMap.put("resCode", "0003");
                    return resCodeMap;
                }
                ;
                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    resCodeMap.put("resCode", "0004");
                    return resCodeMap;
                }
                ;
                Element body = rootment.element("BODY");
                if (body == null) {
                    resCodeMap.put("resCode", "0005");
                    return resCodeMap;
                }
                ;
                Element responseCode1 = body.element("RESPONSE_CODE");
                if (responseCode1 == null) {
                    resCodeMap.put("resCode", "0004");
                    return resCodeMap;
                }
                ;
                Element resDesc = body.element("RESPONSE_DESC");
                if (resDesc == null) {
                    resCodeMap.put("resCode", "0006");
                    return resCodeMap;
                }
                ;
                if ("0000".equals(responseCode.getTextTrim())) {
                    Element ACCOUNT_NO = body.element("ACCOUNT_NO");
                    if (ACCOUNT_NO == null) {
                        resCodeMap.put("resCode", "0015");
                        return resCodeMap;
                    }
                    ;
                    Element AMOUNT = body.element("AMOUNT");
                    if (AMOUNT == null) {
                        resCodeMap.put("resCode", "0016");
                        return resCodeMap;
                    }
                    ;
                } else {
                    resCodeMap.put("resCode", responseCode.getTextTrim());
                    return resCodeMap;
                }
            }

//		{0005=接收的xml格式无内容, 0004=接收的xml格式无响应码, 0006=接收的xml格式无描述, 0001=接收的xml格式错误, 0000=成功, 0003=请求没有HEAD节点, 0002=请求没有ARAMARK_REQUEST节点, resCode=0015, 0009=接收的xml格式无孩子, 9999=失败}

        } catch (Exception e) {
            e.printStackTrace();
        }
        return resCodeMap;
    }


    //
//	/**
//	 * <ARAMARK_RESPONSE>
//	 *  	<HEAD>
//	 *  		<VERSION></VERSION>
//	 *  		<PASSWORD></PASSWORD>
//	 * 			<REQUEST_CUS></REQUEST_CUS>
//	 *  		<REQUEST_TYPE></REQUEST_TYPE>
//	 *  		<PROJECT_CODE></PROJECT_CODE>
//	 *  		<REQUEST_UNIQUE></REQUEST_UNIQUE>
//	 *  		<RESPONSE_CODE></RESPONSE_CODE>
//	 *  		<RESPONSE_TIME></RESPONSE_TIME>
//	 * 			<BODY>
//	 *  			<RESPONSE_CODE></RESPONSE_CODE>
//	 *  			<RESPONSE_DESC></RESPONSE_DESC>
//	 *  			<CARD_ACCOUNT>
//	 *  				<ACCOUNT_ID></ACCOUNT_ID>
//	 *  				<ACCOUNT_NO></ACCOUNT_NO>
//	 *  				<ACCOUNT_TYPE></ACCOUNT_TYPE>
//	 *  				<CUSTOMER_NAME></CUSTOMER_NAME>
//	 *  				<CUSTOMER_MALE></CUSTOMER_MALE>
//	 *  				<ACCOUNT_NO></ACCOUNT_NO>
//	 *  				<AMOUNT></AMOUNT>
//	 *  				<TIMES></TIMES>
//	 *  				<STATUS></STATUS>	//状态(0:启用,1:停用)
//	 *  			</CARD_ACCOUNT>
//	 * 			</BODY>
//	 *	 	</HEAD>
//	 * </ARAMARK_RESPONSE>
//	 * @param requestAccountXml
//	 * @param request
//	 * @return
//	 */
    public String resolveReponseAccountXmlKongxc(String requestAccountXml, HttpServletRequest request) {

        try {
            Document doc = DocumentHelper.parseText(requestAccountXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                return "接收的xml格式错误";
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    return "接收的xml格式无头结点";
                }
                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    return "接收的xml格式无响应码";
                }
                Element body = rootment.element("BODY");
                if (body == null) {
                    return "接收的xml格式无内容";
                }
                if ("0000".equals(responseCode.getTextTrim())) {
                    @SuppressWarnings("unchecked")
                    List<Element> accountElementList = body.elements("CARD_ACCOUNT");
                    if (accountElementList == null) {
                        return "接收的xml格式无内容";
                    }

                    Double amount = 0.0;

                    for (int i = 0; i < accountElementList.size(); i++) {
                        MemberBaseInfoModel account = new MemberBaseInfoModel();
                        Element cusinfo = accountElementList.get(i);

                        Element ACCOUNT_ID = cusinfo.element("ACCOUNT_ID");
                        Element ACCOUNT_NO = cusinfo.element("ACCOUNT_NO");
                        Element ACCOUNT_TYPE = cusinfo.element("ACCOUNT_TYPE");
                        Element CUSTOMER_NAME = cusinfo.element("CUSTOMER_NAME");
                        Element CUSTOMER_MALE = cusinfo.element("CUSTOMER_MALE");
                        Element AMOUNT = cusinfo.element("AMOUNT");
                        Element TIMES = cusinfo.element("TIMES");
                        Element STATUS = cusinfo.element("STATUS");


                        account.setAccountId(ACCOUNT_ID.getTextTrim());
                        account.setAccountNo(ACCOUNT_NO.getTextTrim());
                        account.setAccountType(ACCOUNT_TYPE.getTextTrim());
                        account.setCustomerName(CUSTOMER_NAME.getTextTrim());
                        if (AMOUNT.getTextTrim() != null && StringTools.hasText(STATUS.getTextTrim()) && "1".equals(STATUS.getTextTrim())) {
                            account.setAmount(Double.parseDouble(AMOUNT.getTextTrim()));
                            amount += account.getAmount();
                        } else {
                            account.setAmount(0.0);
                        }
                        if (TIMES.getTextTrim() != null) {
                            account.setTimes(Integer.parseInt(TIMES.getTextTrim()));
                        } else {
                            account.setTimes(0);
                        }
                        account.setAmountStatus(STATUS.getTextTrim());
                    }
                    request.getSession().removeAttribute("amount");
                    request.getSession().setAttribute("amount", amount);
                    return responseCode.getTextTrim();
                } else {
                    Element responseDesc = body.element("RESPONSE_DESC");
                    if (responseDesc == null) {
                        return "接收的xml格式无描述";
                    }
                    return responseDesc.getTextTrim();
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "9999";
    }

    //	public Map<String,String> resResBalanceXmlKongxc(String requestAccountXml){
//
//		resCodeMap.put("resCode", "0000");
//		try {
//			Document doc = DocumentHelper.parseText(requestAccountXml);
//			Element rootment = doc.getRootElement();// 获取根节点
//			if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
//				resCodeMap.put("resCode", "0002");
//				return  resCodeMap;
//			}else{
//				Element head = rootment.element("HEAD");
//				if(head == null ) {
//					resCodeMap.put("resCode", "0003");
//					return  resCodeMap;
//				};
//				Element responseCode = head.element("RESPONSE_CODE");
//				System.out.println("responseCode:"+responseCode.getStringValue());
//				if(responseCode.getStringValue() == null){
//					resCodeMap.put("resCode", "0004");
//					return  resCodeMap;
//				};
//				Element body = rootment.element("BODY");
//				if(body == null) {
//					resCodeMap.put("resCode", "0005");
//					return  resCodeMap;
//				};
//			/*	Element responseCode1 = body.element("RESPONSE_CODE");
//				if(responseCode1 == null){
//					resCodeMap.put("resCode", "0004");
//					return  resCodeMap;
//				}; */
//				/*Element resDesc = body.element("RESPONSE_DESC");
//				if(resDesc == null){
//					resCodeMap.put("resCode", "0006");
//					return  resCodeMap;
//				}; */
//				if(resCodeMap.get("resCode").equals("0000")){
//
//				@SuppressWarnings("unchecked")
//				List<Element> list =	body.elements("CARD_ACCOUNT");
//				if(list!=null && list.size()>0){
//					for (Element li : list) {
//						Element acccType = li.element("ACCOUNT_TYPE");
//						Element amount = li.element("AMOUNT");
//						Element accName = li.element("ACCOUNT_TYPE_NAME");
//						if(acccType==null ||amount==null||accName==null){
//							resCodeMap.put("resCode", "0008");
//							return  resCodeMap;
//						}
//					}
//				}else{
//					resCodeMap.put("resCode", "0007");
//					return  resCodeMap;
//				}
//				}
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return resCodeMap;
//	}
//

    /**
     * <ARAMARK_RESPONSE>
     * <HEAD>
     * <VERSION>1.0</VERSION>
     * <REQUEST_CUS>OL</REQUEST_CUS>
     * <REQUEST_TYPE>DD001</REQUEST_TYPE>
     * <PROJECT_CODE>1234567</PROJECT_CODE>
     * <REQUEST_UNIQUE>1daee91c57834639803fcf45e4c97eed</REQUEST_UNIQUE>
     * <RESPONSE_CODE>0000</RESPONSE_CODE>
     * <RESPONSE_DESC>成功</RESPONSE_DESC>
     * <RESPONSE_TIME>2017-11-25 16:42:18</RESPONSE_TIME>
     * </HEAD>
     * <BODY>
     * <RESULT>0000</RESULT>
     * <RESPONSE_DESC>成功</RESPONSE_DESC>
     * <TRADE_FLOW>1234567</TRADE_FLOW>
     * </BODY>
     * </ARAMARK_RESPONSE>
     */
    public Map<String, String> resRescarPayXmlKongxc(String requestAccountXml) {
        resCodeMap.put("resCode", "0000");
        try {
            Document doc = DocumentHelper.parseText(requestAccountXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
                resCodeMap.put("resCode", "0002");
                return resCodeMap;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    resCodeMap.put("resCode", "0003");
                    return resCodeMap;
                }
                ;
                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    resCodeMap.put("resCode", "0004");
                    return resCodeMap;
                }
                ;
                Element body = rootment.element("BODY");
                if (body == null) {
                    resCodeMap.put("resCode", "0005");
                    return resCodeMap;
                }
                ;
                Element responseCode1 = body.element("RESPONSE_CODE");
                if (responseCode1 == null) {
                    resCodeMap.put("resCode", "0004");
                    return resCodeMap;
                }
                ;
                Element resDesc = body.element("RESPONSE_DESC");
                if (resDesc == null) {
                    resCodeMap.put("resCode", "0006");
                    return resCodeMap;
                }
                ;
                if (resCodeMap.get("resCode").equals("0000")) {

                    @SuppressWarnings("unchecked")
                    Element li = body.element("TRADE_FLOW");
                    if (li == null) {
                        resCodeMap.put("resCode", "0009");
                        return resCodeMap;
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resCodeMap;
    }

    public String resolveReponseAccountXml(String requestAccountXml, HttpServletRequest request) {

        String errorCode = "9999";
        try {
            Document doc = DocumentHelper.parseText(requestAccountXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                return errorCode;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    return errorCode;
                }
                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    return errorCode;
                }
                if ("0000".equals(responseCode.getTextTrim())) {
                    Element BODY = rootment.element("BODY");
                    if (BODY == null) {
                        return errorCode;
                    }
                    List<Element> accountElementList = BODY.elements("CARD_ACCOUNT");
//					List<Element> accountElementList = .elements();
                    if (accountElementList == null) {
                        return errorCode;
                    }

                    Double amount = 0.0;

                    for (int i = 0; i < accountElementList.size(); i++) {
                        MemberBaseInfoModel account = new MemberBaseInfoModel();
                        Element cusinfo = accountElementList.get(i);

                        Element ACCOUNT_ID = cusinfo.element("ACCOUNT_ID");
                        Element ACCOUNT_NO = cusinfo.element("ACCOUNT_NO");
                        Element ACCOUNT_TYPE = cusinfo.element("ACCOUNT_TYPE");
                        Element CUSTOMER_NAME = cusinfo.element("CUSTOMER_NAME");
                        Element AMOUNT = cusinfo.element("AMOUNT");
                        Element TIMES = cusinfo.element("TIMES");
                        Element STATUS = cusinfo.element("STATUS");


                        account.setAccountId(ACCOUNT_ID.getTextTrim());
                        account.setAccountNo(ACCOUNT_NO.getTextTrim());
                        account.setAccountType(ACCOUNT_TYPE.getTextTrim());
                        account.setCustomerName(CUSTOMER_NAME.getTextTrim());
                        if (AMOUNT.getTextTrim() != null) {
                            account.setAmount(Double.parseDouble(AMOUNT.getTextTrim()));
                            amount += account.getAmount();
                        } else {
                            account.setAmount(0.0);
                        }
                        if (TIMES.getTextTrim() != null) {
                            account.setTimes(Integer.parseInt(TIMES.getTextTrim()));
                        } else {
                            account.setTimes(0);
                        }
                        account.setAmountStatus(STATUS.getTextTrim());
                    }

                    request.getSession().removeAttribute("amount");
                    request.getSession().setAttribute("amount", amount);

                    return responseCode.getTextTrim();
                } else {
                    return errorCode;
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "9999";
    }

    //
///**
//* 查询用户交易流水
//* @param password
//* @param cupassword
//* @param uuid
//* @return
//*
//* <ARAMARK_REQUEST>
//*  	<HEAD>
//*  		<VERSION></VERSION>
//*  		<PASSWORD></PASSWORD>
//* 		<REQUEST_CUS></REQUEST_CUS>
//*  		<REQUEST_TYPE>ACCOUNT_TRADE</REQUEST_TYPE>
//*  		<PROJECT_CODE></PROJECT_CODE>
//*  		<REQUEST_UNIQUE></REQUEST_UNIQUE>
//* 	</HEAD>
//* 	<BODY>
//*  			<CUSTOMER_NO></CUSTOMER_NO>
//*  			<CUSTOMER_PWD></CUSTOMER_PWD>
//* 	</BODY>
//* </ARAMARK_REQUEST>
//*
//*/
//public  String requestMemTradeInfoKongxc(String password,String proName, String projectCode,String idNumber,String cupassword,String uuid,String type,String pageSize,String pageIndex){
//	String requestAccountXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//	requestAccountXml+="<ARAMARK_REQUEST>";
//	requestAccountXml+="<HEAD>";
//	requestAccountXml+="<VERSION>1.0</VERSION>";
//	requestAccountXml+="<PASSWORD>"+password+"</PASSWORD>";
//	requestAccountXml+="<REQUEST_CUS>"+proName+"</REQUEST_CUS>";
//	requestAccountXml+="<REQUEST_TYPE>ACCOUNT_TRADE</REQUEST_TYPE>";
//	requestAccountXml+="<PROJECT_CODE>"+projectCode+"</PROJECT_CODE>";
//	requestAccountXml+="<REQUEST_UNIQUE>"+uuid+"</REQUEST_UNIQUE>";
//	requestAccountXml+="</HEAD>";
//	requestAccountXml+="<BODY>";
//	requestAccountXml+="<CUSTOMER_NO>"+idNumber+"</CUSTOMER_NO>";
//	requestAccountXml+="<CUSTOMER_PWD>"+cupassword+"</CUSTOMER_PWD>";
//	requestAccountXml+="<TYPE>"+type+"</TYPE>";
//	requestAccountXml+="<PAGE_SIZE>"+pageSize+"</PAGE_SIZE>";
//	requestAccountXml+="<PAGE_INDEX>"+pageIndex+"</PAGE_INDEX>";
//	requestAccountXml+="</BODY>";
//	requestAccountXml+="</ARAMARK_REQUEST>";
//	return requestAccountXml;
//}
//public  String requestMemTradeRecipesKongxc(String password,String proName, String projectCode,String idNumber,String cupassword,String uuid,String type,String pageSize,String pageIndex){
//	String requestAccountXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//	requestAccountXml+="<ARAMARK_REQUEST>";
//	requestAccountXml+="<HEAD>";
//	requestAccountXml+="<VERSION>1.0</VERSION>";
//	requestAccountXml+="<PASSWORD>"+password+"</PASSWORD>";
//	requestAccountXml+="<REQUEST_CUS>"+proName+"</REQUEST_CUS>";
//	requestAccountXml+="<REQUEST_TYPE>ACCOUNT_RECIPE_TRADE</REQUEST_TYPE>";
//	requestAccountXml+="<PROJECT_CODE>"+projectCode+"</PROJECT_CODE>";
//	requestAccountXml+="<REQUEST_UNIQUE>"+uuid+"</REQUEST_UNIQUE>";
//	requestAccountXml+="</HEAD>";
//	requestAccountXml+="<BODY>";
//	requestAccountXml+="<CUSTOMER_NO>"+idNumber+"</CUSTOMER_NO>";
//	requestAccountXml+="<CUSTOMER_PWD>"+cupassword+"</CUSTOMER_PWD>";
//	requestAccountXml+="<TYPE>"+type+"</TYPE>";
//	requestAccountXml+="<PAGE_SIZE>"+pageSize+"</PAGE_SIZE>";
//	requestAccountXml+="<PAGE_INDEX>"+pageIndex+"</PAGE_INDEX>";
//	requestAccountXml+="</BODY>";
//	requestAccountXml+="</ARAMARK_REQUEST>";
//	return requestAccountXml;
//}
//
//
//public Map<String,String> resResTradeXmlKongxc(String requestAccountXml){
//	resCodeMap.put("resCode", "0000");
//	try {
//		Document doc = DocumentHelper.parseText(requestAccountXml);
//		Element rootment = doc.getRootElement();// 获取根节点
//		if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
//			resCodeMap.put("resCode", "0002");
//			return  resCodeMap;
//		}else{
//			Element head = rootment.element("HEAD");
//			if(head == null ) {
//				resCodeMap.put("resCode", "0003");
//				return  resCodeMap;
//			};
//			Element responseCode = head.element("RESPONSE_CODE");
//			if(responseCode == null){
//				resCodeMap.put("resCode", "0004");
//				return  resCodeMap;
//			};
//			Element body = rootment.element("BODY");
//			if(body == null) {
//				resCodeMap.put("resCode", "0005");
//				return  resCodeMap;
//			};
//			Element responseCode1 = body.element("RESPONSE_CODE");
//			if(responseCode1 == null){
//				resCodeMap.put("resCode", "0004");
//				return  resCodeMap;
//			};
//			Element resDesc = body.element("RESPONSE_DESC");
//			if(resDesc == null){
//				resCodeMap.put("resCode", "0006");
//				return  resCodeMap;
//			};
//			if(resCodeMap.get("resCode").equals("0000")){
//
//			@SuppressWarnings("unchecked")
//			List<Element> list =	body.elements("TRADE_FLOW");
//			if(list!=null && list.size()>0){
//				for (Element li : list) {
//					Element acccType = li.element("TRAADE_NO");
//					Element amount = li.element("TYPE");
//					Element accName = li.element("TRAADE_AMOUNT");
//					Element time = li.element("TIME");
//					Element description = li.element("DESCRIPTION");
//					if(acccType==null ||amount==null||accName==null||time==null||description==null){
//						resCodeMap.put("resCode", "0008");
//						return  resCodeMap;
//					}
//				}
//			}/*else{
//				resCodeMap.put("resCode", "0007");
//				return  resCodeMap;
//			}*/
//			}
//		}
//	} catch (Exception e) {
//		e.printStackTrace();
//	}
//	return resCodeMap;
//}
//
//
//
//@SuppressWarnings("unused")
//public  List<MemberBaseInfoModel> resXmlTraDetKongxc(String requestAccountXml) throws ParseException{
//	List<MemberBaseInfoModel> list = new ArrayList<MemberBaseInfoModel>();
//	try {
//		Document doc = DocumentHelper.parseText(requestAccountXml);
//		Element rootment = doc.getRootElement();// 获取根节点
//		Element BODY = rootment.element("BODY");
//		@SuppressWarnings("unchecked")
//		List<Element> accountElementList = BODY.elements("TRADE_FLOW");
//		for(int i=0; i < accountElementList.size(); i++ ){
//			MemberBaseInfoModel memberBaseInfoModel = new MemberBaseInfoModel();
//			Element accountInfo = accountElementList.get(i);
//			Element amount = accountInfo.element("TRAADE_AMOUNT");
//			Element type = accountInfo.element("TYPE");
//			Element description = accountInfo.element("DESCRIPTION");
//			Element tradeNo = accountInfo.element("TRAADE_NO");
//			Element time = accountInfo.element("TIME");
//			if(amount.getTextTrim() != null &&type.getTextTrim() != null&& tradeNo.getTextTrim() != null&& time.getTextTrim() != null&& description.getTextTrim()!=null){
//				memberBaseInfoModel.setAmount(Double.parseDouble(amount.getTextTrim()));
//				memberBaseInfoModel.setAccountType(type.getTextTrim());
//				memberBaseInfoModel.setTradeNo(tradeNo.getTextTrim());
//				String temp = time.getTextTrim();
//				Calendar c = TimeTools.string2Calendar(temp);
//				Long l = c.getTimeInMillis();
//				memberBaseInfoModel.setTradeTime(String.valueOf(l));
//				memberBaseInfoModel.setDescription(description.getTextTrim());
//			}else{
//				memberBaseInfoModel.setAmount(0.0);
//			}
//			list.add(memberBaseInfoModel);
//		}
//		System.out.println("accountElementList--->>"+accountElementList.size());
//		if(accountElementList.size() == 0){//没有交易记录
//			MemberBaseInfoModel baseInfoModel = new MemberBaseInfoModel();
//			list.add(baseInfoModel);
//		}
//		return list;
//	} catch (DocumentException e) {
//		e.printStackTrace();
//	}
//	return list;
//}
//
//
//
//
//public  List<MemberBaseInfoModel> resXmlSumKongxc(String requestAccountXml){
//	List<MemberBaseInfoModel> list = new ArrayList<MemberBaseInfoModel>();
//	try {
//		Document doc = DocumentHelper.parseText(requestAccountXml);
//		Element rootment = doc.getRootElement();// 获取根节点
//		Element BODY = rootment.element("BODY");
//		@SuppressWarnings("unchecked")
//		List<Element> accountElementList = BODY.elements("CARD_ACCOUNT");
//		for(int i=0; i < accountElementList.size(); i++ ){
//			MemberBaseInfoModel memberBaseInfoModel = new MemberBaseInfoModel();
//			Element accountInfo = accountElementList.get(i);
//			Element amount = accountInfo.element("AMOUNT");
//			Element type = accountInfo.element("ACCOUNT_TYPE");
//			Element accName = accountInfo.element("ACCOUNT_TYPE_NAME");
//			if(amount.getTextTrim() != null &&type.getTextTrim() != null&& accName.getTextTrim() != null){
//				memberBaseInfoModel.setAmount(Double.parseDouble(amount.getTextTrim()));
//				memberBaseInfoModel.setAccountType(type.getTextTrim());
//				memberBaseInfoModel.setAccName(accName.getTextTrim());
//			}else{
//				memberBaseInfoModel.setAmount(0.0);
//			}
//			list.add(memberBaseInfoModel);
//		}
//		return list;
//	} catch (DocumentException e) {
//		e.printStackTrace();
//	}
//	return list;
//}
//
//public  String resXmlcarPayKongxc(String requestAccountXml){
//	try {
//		Document doc = DocumentHelper.parseText(requestAccountXml);
//		Element rootment = doc.getRootElement();// 获取根节点
//		Element BODY = rootment.element("BODY");
//		@SuppressWarnings("unchecked")
//		Element flowNo = BODY.element("TRADE_FLOW");
//
//		return flowNo.getTextTrim();
//	} catch (DocumentException e) {
//		e.printStackTrace();
//	}
//	return null;
//}
//
//public  List<MemberBaseInfoModel> resXmlTradeKongxc(String requestAccountXml){
//	List<MemberBaseInfoModel> list = new ArrayList<MemberBaseInfoModel>();
//	try {
//		Document doc = DocumentHelper.parseText(requestAccountXml);
//		Element rootment = doc.getRootElement();// 获取根节点
//		Element BODY = rootment.element("BODY");
//		@SuppressWarnings("unchecked")
//		List<Element> accountElementList = BODY.elements("TRADE_FLOW");
//		for(int i=0; i < accountElementList.size(); i++ ){
//			MemberBaseInfoModel memberBaseInfoModel = new MemberBaseInfoModel();
//			Element accountInfo = accountElementList.get(i);
//			Element tradeNoElement = accountInfo.element("TRAADE_NO");
//			Element typeElement = accountInfo.element("TYPE");
//			Element tradeAmountElement = accountInfo.element("TRAADE_AMOUNT");
//			Element timeElement = accountInfo.element("TIME");
//			if(accountInfo.getTextTrim() != null &&tradeNoElement.getTextTrim() != null&& typeElement.getTextTrim() != null&&timeElement!=null){
//				memberBaseInfoModel.setAmount(Double.valueOf(tradeAmountElement.getTextTrim()));
//				memberBaseInfoModel.setTradeNo(tradeNoElement.getTextTrim());
//				memberBaseInfoModel.setFlowType(typeElement.getTextTrim());
//				memberBaseInfoModel.setTradeTime(timeElement.getTextTrim());
//			}else{
//				memberBaseInfoModel.setAmount(0.0);
//			}
//			list.add(memberBaseInfoModel);
//		}
//		return list;
//	} catch (DocumentException e) {
//		e.printStackTrace();
//	}
//	return list;
//}
//
    public List<MemberBaseInfoModel> resolveReponseAccountXml(String requestAccountXml) {
        List<MemberBaseInfoModel> list = new ArrayList<MemberBaseInfoModel>();
        try {
            Document doc = DocumentHelper.parseText(requestAccountXml);
            Element rootment = doc.getRootElement();// 获取根节点

            Element BODY = rootment.element("BODY");
            if (BODY == null) {
                return list;
            }
            @SuppressWarnings("unchecked")
            List<Element> accountElementList = BODY.elements("CARD_ACCOUNT");
            Double amount = 0.0;
            for (int i = 0; i < accountElementList.size(); i++) {
                MemberBaseInfoModel memberBaseInfoModel = new MemberBaseInfoModel();
                Element accountInfo = accountElementList.get(i);
                Element ACCOUNT_ID = accountInfo.element("ACCOUNT_ID");
                Element ACCOUNT_NO = accountInfo.element("ACCOUNT_NO");
                Element ACCOUNT_TYPE = accountInfo.element("ACCOUNT_TYPE");
                Element CUSTOMER_NAME = accountInfo.element("CUSTOMER_NAME");
                Element AMOUNT = accountInfo.element("AMOUNT");
                Element TIMES = accountInfo.element("TIMES");
                Element STATUS = accountInfo.element("STATUS");
                Element EFFECT_DATE = accountInfo.element("EFFECT_DATE");


                memberBaseInfoModel.setAccountId(ACCOUNT_ID.getTextTrim());
                memberBaseInfoModel.setAccountNo(ACCOUNT_NO.getTextTrim());
                memberBaseInfoModel.setAccountType(ACCOUNT_TYPE.getTextTrim());
                memberBaseInfoModel.setCustomerName(CUSTOMER_NAME.getTextTrim());
                memberBaseInfoModel.setEffectDate(LocalDateTimeUtil.parse(EFFECT_DATE.getText(), "yyyy-MM-dd HH:mm:ss"));
                if (TIMES.getTextTrim() != null) {
                    memberBaseInfoModel.setTimes(Integer.parseInt(TIMES.getTextTrim()));
                } else {
                    memberBaseInfoModel.setTimes(0);
                }
                if (AMOUNT.getTextTrim() != null && StringTools.hasText(STATUS.getTextTrim())) {
                    memberBaseInfoModel.setAmount(Double.parseDouble(AMOUNT.getTextTrim()));
                    amount += memberBaseInfoModel.getAmount();
                } else {
                    memberBaseInfoModel.setAmount(0.0);
                }
                memberBaseInfoModel.setAmountStatus(STATUS.getTextTrim());
                if (memberBaseInfoModel.getEffectDate().isAfter(LocalDateTime.now())) {
                    list.add(memberBaseInfoModel);
                }
            }
            return list;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

    //解析消费记录
    public String resolveReponseConsumptionRecord(String requestAccountXml, HttpServletRequest request) {
        List<CardConsumptionModel> conList = new ArrayList<CardConsumptionModel>();
        String errorCode = "9999";
        try {

            Document doc = DocumentHelper.parseText(requestAccountXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                return errorCode;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    return errorCode;
                }

                Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
                if (RESPONSE_ELEMENT == null) {
                    return errorCode;
                }

                if ("0000".equals(RESPONSE_ELEMENT.getTextTrim())) {

                    Element BODY = rootment.element("BODY");
                    if (BODY == null) {
                        return errorCode;
                    }

                    List<Element> recordList = BODY.elements();
                    if (recordList == null) {
                        return errorCode;
                    }

                    for (int i = 0; i < recordList.size(); i++) {
                        CardConsumptionModel account = new CardConsumptionModel();
                        Element conInfo = recordList.get(i);

                        Element CUSTOMER_NAME = conInfo.element("CUSTOMER_NAME");
                        Element MEAL_TIME_NAME = conInfo.element("MEAL_TIME_NAME");
                        Element FOOD_NAME = conInfo.element("FOOD_NAME");
                        Element FOOD_NO = conInfo.element("FOOD_NO");
                        Element FOOD_PRICE = conInfo.element("FOOD_PRICE");
                        Element QUANTITY = conInfo.element("QUANTITY");
                        Element TOTAL_PRICE = conInfo.element("TOTAL_PRICE");
                        Element CON_TIME = conInfo.element("CON_TIME");


                        account.setFoodCode(FOOD_NO.getTextTrim());
                        account.setCustomerName(CUSTOMER_NAME.getTextTrim());
                        account.setMealTimeName(MEAL_TIME_NAME.getTextTrim());
                        account.setFoodName(FOOD_NAME.getTextTrim());
                        account.setFoodPrice(FOOD_PRICE.getTextTrim());
                        account.setQuantity(QUANTITY.getTextTrim());
                        account.setTotalPrice(TOTAL_PRICE.getTextTrim());
                        account.setConTime(CON_TIME.getTextTrim());
                        account.setSortTime(CON_TIME.getTextTrim());
                        conList.add(account);
                    }
                    request.setAttribute("conList", conList);
                    return RESPONSE_ELEMENT.getTextTrim();
                } else {
                    return errorCode;
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "9999";
    }


    //解析储值记录
    public String resolveStoredXML(String reponseStoredXML, HttpServletRequest request) {
        List<CardStoredModel> storeList = new ArrayList<CardStoredModel>();
        String errorCode = "9999";
        try {

            Document doc = DocumentHelper.parseText(reponseStoredXML);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                return errorCode;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    return errorCode;
                }

                Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
                if (RESPONSE_ELEMENT == null) {
                    return errorCode;
                }

                if ("0000".equals(RESPONSE_ELEMENT.getTextTrim())) {

                    Element BODY = rootment.element("BODY");
                    if (BODY == null) {
                        return errorCode;
                    }

                    Element CONSUMER_RECORDS = BODY.element("CONSUMER_RECORDS");
                    if (CONSUMER_RECORDS == null) {
                        return errorCode;
                    }

                    List<Element> recordList = CONSUMER_RECORDS.elements();
                    if (recordList == null) {
                        return errorCode;
                    }

                    for (int i = 0; i < recordList.size(); i++) {
                        CardStoredModel stored = new CardStoredModel();
                        Element conInfo = recordList.get(i);
//						CONSUMER_STORE	CUSTOMER_NAME	必须	不为空	顾客名称
//						CONSUMER_STORE	CUSTOMER_NO	必须	不为空	顾客编号
//						CONSUMER_STORE	OPT_NAME	必须	不为空	储值人操作人
//						CONSUMER_STORE	ACTUAL_AMOUNT	必须	不为空	储值金额
//						CONSUMER_STORE	ACTUAL_TIMES	必须	不为空	储值次数
//						CONSUMER_STORE	STORE_TIME	必须	不为空	储值时间

                        Element CUSTOMER_NAME = conInfo.element("CUSTOMER_NAME");
                        Element CUSTOMER_NO = conInfo.element("CUSTOMER_NO");
                        Element OPT_NAME = conInfo.element("OPT_NAME");
                        Element OPERATE_TYPE = conInfo.element("OPERATE_TYPE");

                        Element BEFORE_AMOUNT = conInfo.element("BEFORE_AMOUNT");
                        Element ACTUAL_AMOUNT = conInfo.element("ACTUAL_AMOUNT");
                        Element BEFORE_TIMES = conInfo.element("BEFORE_TIMES");
                        Element ACTUAL_TIMES = conInfo.element("ACTUAL_TIMES");
                        Element STORE_TIME = conInfo.element("STORE_TIME");
                        Element AFTER_TIMES = conInfo.element("AFTER_TIMES");
                        Element AFTER_AMOUNT = conInfo.element("AFTER_AMOUNT");

                        stored.setCustomerName(CUSTOMER_NAME.getTextTrim());
                        stored.setCustomerNo(CUSTOMER_NO.getTextTrim());
                        stored.setOptName(OPT_NAME.getTextTrim());
                        stored.setOrderType(OPERATE_TYPE.getTextTrim());

                        stored.setBeforeAmount(BEFORE_AMOUNT.getTextTrim());
                        stored.setActualAmount(ACTUAL_AMOUNT.getTextTrim());
                        stored.setActualTimes(ACTUAL_TIMES.getTextTrim());

                        stored.setBeforeTimes(BEFORE_TIMES.getTextTrim());
                        stored.setAfterAmount(AFTER_AMOUNT.getTextTrim());
                        stored.setAfterTimes(AFTER_TIMES.getTextTrim());

                        stored.setSortTime(STORE_TIME.getTextTrim());

                        storeList.add(stored);
                    }
                    request.setAttribute("storeList", storeList);
                    return RESPONSE_ELEMENT.getTextTrim();
                } else {
                    return errorCode;
                }

            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "9999";
    }

    //
//
//
    public String requestStoreXml(String PASSWORD, String REQUEST_CUS, String PROJECT_CODE, String TICKET, MemberBaseInfoModel account) {
        String requestStoreXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestStoreXml += "<ARAMARK_REQUEST>";
        requestStoreXml += "<HEAD>";
        requestStoreXml += "<VERSION>1.0</VERSION>";
        requestStoreXml += "<PASSWORD>" + PASSWORD + "</PASSWORD>";
        requestStoreXml += "<REQUEST_CUS>" + REQUEST_CUS + "</REQUEST_CUS>";
        requestStoreXml += "<REQUEST_TYPE>ST001</REQUEST_TYPE>";
        requestStoreXml += "<PROJECT_CODE>" + PROJECT_CODE + "</PROJECT_CODE>";
        requestStoreXml += "<REQUEST_UNIQUE>" + account.getRequestUnique() + "</REQUEST_UNIQUE>";
        requestStoreXml += "<REQUEST_TIME>2014-05-22 11:11:11</REQUEST_TIME>";
        requestStoreXml += "<TICKET>" + TICKET + "</TICKET>";
        requestStoreXml += "<STORE_CONDITION>";
        requestStoreXml += "	<ACCOUNT_ID>" + account.getAccountId() + "</ACCOUNT_ID>";
        requestStoreXml += "	<ACCOUNT_NO>" + account.getAccountNo() + "</ACCOUNT_NO>";
        requestStoreXml += "	<ACCOUNT_AMOUNT>" + account.getAmount() + "</ACCOUNT_AMOUNT>";
        requestStoreXml += "	<CUPASSWORD>" + account.getCustomerPassword() + "</CUPASSWORD>";
        requestStoreXml += "</STORE_CONDITION>";
        requestStoreXml += "</HEAD>";
        requestStoreXml += "</ARAMARK_REQUEST>";
        return requestStoreXml;
    }

    //
//
    public String resolveStoreXml(String requestStoreXml) {
        String errorCode = "9999";
        try {
            Document doc = DocumentHelper.parseText(requestStoreXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                return errorCode;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    return errorCode;
                }

                Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
                if (RESPONSE_ELEMENT == null) {
                    return errorCode;
                }

                if ("0000".equals(RESPONSE_ELEMENT.getTextTrim())) {

                    return RESPONSE_ELEMENT.getTextTrim();
                } else {
                    return errorCode;
                }
            }
        } catch (Exception e) {
            // TODO: handle exception
        }

        return "9999";

    }

    //
//
//
//public String requestTicket(String iFPassWord,String education,String educationCode,String uuid){
//
//		String ticket="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//		ticket+="<ARAMARK_REQUEST>";
//		ticket+="<HEAD>";
//		ticket+="<VERSION>1.0</VERSION>";
//		ticket+="<PASSWORD>"+iFPassWord+"</PASSWORD>";
//		ticket+="<REQUEST_CUS>"+education+"</REQUEST_CUS>";
//		ticket+="<REQUEST_TYPE>UID001</REQUEST_TYPE>";
//		ticket+="<PROJECT_CODE>"+educationCode+"</PROJECT_CODE>";
//		ticket+="<REQUEST_UNIQUE>"+uuid+"</REQUEST_UNIQUE>";
//		ticket+="</HEAD>";
//		ticket+="</ARAMARK_REQUEST>";
//
//		return ticket;
//	}
//
//	public String  requestLoginInfo(String iFPassWord,String education,String educationCode,String ticket,String userName,String passWord){
//
//		String requestLoginXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//		requestLoginXml+="<ARAMARK_REQUEST>";
//		requestLoginXml+="<HEAD>";
//		requestLoginXml+="<VERSION>1.0</VERSION>";
//		requestLoginXml+="<PASSWORD>"+iFPassWord+"</PASSWORD>";
//		requestLoginXml+="<REQUEST_CUS>"+education+"</REQUEST_CUS>";
//		requestLoginXml+="<REQUEST_TYPE>LG001</REQUEST_TYPE>";
//		requestLoginXml+="<PROJECT_CODE>"+educationCode+"</PROJECT_CODE>";
//		requestLoginXml+="<REQUEST_UNIQUE>"+UUID.randomUUID().toString().replace("-", "")+"</REQUEST_UNIQUE>";
//		requestLoginXml+="<REQUEST_TIME>2014-05-22 11:11:11</REQUEST_TIME>";
//		requestLoginXml+="<TICKET>"+ticket+"</TICKET>";
//		requestLoginXml+="<REQUEST_CONDITION>";
//		requestLoginXml+="<USER_NAME>"+userName+"</USER_NAME>";
//		requestLoginXml+="<USER_PASSWORD>"+passWord+"</USER_PASSWORD>";
//		requestLoginXml+="</REQUEST_CONDITION>";
//		requestLoginXml+="</HEAD>";
//		requestLoginXml+="</ARAMARK_REQUEST>";
//
//
//		return requestLoginXml;
//	}
//
//	public String resolveTicket(String reponseTicket){
//		String errorCode = "9999";
//		try {
//			Document doc = DocumentHelper.parseText(reponseTicket);
//			Element rootment = doc.getRootElement();// 获取根节点
//			if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
//				return  errorCode;
//			}else{
//				Element head = rootment.element("HEAD");
//				if(head == null ) return errorCode;
//
//				Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
//				if(RESPONSE_ELEMENT == null) return errorCode;
//
//				if("0000".equals(RESPONSE_ELEMENT.getTextTrim())){
//					Element BODY  = rootment.element("BODY");
//					if(BODY == null) return errorCode;
//
//					Element TICKET = BODY.element("TICKET");
//					if(TICKET == null) return errorCode;
//
//					return TICKET.getTextTrim();
//
//				}else{
//					return errorCode;
//				}
//			}
//		} catch (DocumentException e) {
//			e.printStackTrace();
//			return errorCode;
//		}
//	}
//
//
//	public String responseModPasswordXml(String requestModPasswordXml){
//		String errorCode = "9999";
//		try {
//			Document doc = DocumentHelper.parseText(requestModPasswordXml);
//			Element rootment = doc.getRootElement();// 获取根节点
//			if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
//				return  errorCode;
//			}else{
//				Element head = rootment.element("HEAD");
//				if(head == null ) return errorCode;
//
//				Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
//				if(RESPONSE_ELEMENT == null) return errorCode;
//				return RESPONSE_ELEMENT.getTextTrim();
//			}
//		} catch (DocumentException e) {
//			e.printStackTrace();
//			return errorCode;
//		}
//	}
//	//ZC001
    public String requestRegistInfo(String iFPassWord, String education, String educationCode, MemberBaseInfo memberBaseInfo) {

        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + iFPassWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + education + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>ZC001</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + educationCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "<REQUEST_CONDITION>";
        requestRegistXml += "<CUSTOMER_NO>" + memberBaseInfo.getIdNumber() + "</CUSTOMER_NO>";
        requestRegistXml += "<CUSTOMER_NAME>" + memberBaseInfo.getName() + "</CUSTOMER_NAME>";
        requestRegistXml += "<CUSTOMER_PASSWORD>" + memberBaseInfo.getZfPasswd() + "</CUSTOMER_PASSWORD>";
        requestRegistXml += "<CUSTOMER_MALE>";
        requestRegistXml += memberBaseInfo.getMale();//性别
        requestRegistXml += "</CUSTOMER_MALE>";
        requestRegistXml += "<CUSTOMER_EMAIL>" + memberBaseInfo.getEmail() + "</CUSTOMER_EMAIL>";
        requestRegistXml += "<CUSTOMER_MOBILE>" + memberBaseInfo.getMobile() + "</CUSTOMER_MOBILE>";
        requestRegistXml += "<CUSTOMER_TEL></CUSTOMER_TEL>";
        requestRegistXml += "</REQUEST_CONDITION>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "</ARAMARK_REQUEST>";

        return requestRegistXml;
    }

    //
//	/**
//	 * 到订货总部请求获取ACCESS_TOKEN
//	 *
//	 *
//	 * */
    public String requestGetAccessToken(String passWord, String projectName, String schoolCode) {
        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + passWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + projectName + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>KONGXC003</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + schoolCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "</ARAMARK_REQUEST>";
        return requestRegistXml;
    }

    //	/**
//	 * 订货总部返回的xml进行ACCESS_TOKEN解析
//	 * <ARAMARK_RESPONSE>
//	 * 	<HEAD>
//	 * 		<VERSION></VERSION>
//	 * 		<REQUEST_CUS></REQUEST_CUS>
//	 * 		<REQUEST_TYPE></REQUEST_TYPE>
//	 *  	<PROJECT_CODE></PROJECT_CODE>
//	 *  	<REQUEST_UNIQUE></REQUEST_UNIQUE>
//	 *  	<RESPONSE_CODE></RESPONSE_CODE>
//	 *  	<RESPONSE_TIME></RESPONSE_TIME>
//	 * </HEAD>
//	 * <BODY>
//	 * 		<RESPONSE_DESC></RESPONSE_DESC>
//	 * 		<RESPONSE_CODE></RESPONSE_CODE>
//	 * 		<ACCESS_TOKEN></ACCESS_TOKEN>
//	 * </BODY>
//	 * </ARAMARK_RESPONSE>
//	 * */
    public Map<String, String> resolveAccessToken(String requestRegistInfoXml) {
        Map<String, String> map = new HashMap<String, String>();
        String errorCode = "9900";
        try {
            Document doc = DocumentHelper.parseText(requestRegistInfoXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                map.put(errorCode, "网络传输失败，头部结点丢失");
                return map;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    map.put(errorCode, "网络传输失败，头部结点丢失");
                    return map;
                }

                Element responseCode1 = head.element("RESPONSE_CODE");
                if (responseCode1 == null) {
                    map.put(errorCode, "网络传输失败，头部结点丢失");
                    return map;
                }
                Element BODY = rootment.element("BODY");
                if (BODY == null) {
                    map.put(errorCode, "网络传输失败，内容结点丢失");
                    return map;
                }
                Element responseCode = BODY.element("RESPONSE_CODE");
                if (responseCode == null) {
                    map.put(errorCode, "网络传输失败，内容结点丢失");
                    return map;
                }
                Element responseDesc = BODY.element("RESPONSE_DESC");
                if (responseDesc == null) {
                    map.put(errorCode, "网络传输失败，内容结点丢失");
                    return map;
                }
                if ("0000".equals(responseCode.getTextTrim())) {
                    Element accessToken = BODY.element("ACCESS_TOKEN");
                    if (accessToken == null) {
                        map.put(errorCode, "网络传输失败，内容结点丢失");
                        return map;
                    }
                    map.put(responseCode.getTextTrim(), accessToken.getTextTrim());
                } else {
                    map.put(responseCode.getTextTrim(), responseDesc.getTextTrim());
                }

                return map;
            }
        } catch (DocumentException e) {
            e.printStackTrace();
            map.put(errorCode, "解析失败");
            return map;
        }
    }
    /**
     * 个人注册信息推送到订货总部
     * <ARAMARK_REQUEST>
     * 	<HEAD>
     * 		<VERSION></VERSION>
     * 		<REQUEST_TYPE></REQUEST_TYPE>
     *  	<PROJECT_CODE></PROJECT_CODE>
     *  	<REQUEST_CUS></REQUEST_CUS>
     *  	<PASSWORD></PASSWORD>
     *  	<REQUEST_UNIQUE></REQUEST_UNIQUE>
     * </HEAD>
     * </ARAMARK_REQUEST>
     * */
//		public String  requestSendDingHuoMemInfo(String iFPassWord,String education,String schoolCode,MemberBaseInfo memberBaseInfo) throws UnsupportedEncodingException{
//
//			String requestRegistXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//			requestRegistXml+="<ARAMARK_REQUEST>";
//			requestRegistXml+="<HEAD>";
//			requestRegistXml+="<VERSION>1.0</VERSION>";
//			requestRegistXml+="<PASSWORD>"+iFPassWord+"</PASSWORD>";
//			requestRegistXml+="<REQUEST_CUS>"+education+"</REQUEST_CUS>";
//			requestRegistXml+="<REQUEST_TYPE>ZC001</REQUEST_TYPE>";
//			requestRegistXml+="<PROJECT_CODE>"+schoolCode+"</PROJECT_CODE>";
//			requestRegistXml+="<REQUEST_UNIQUE>"+UUID.randomUUID().toString().replace("-", "")+"</REQUEST_UNIQUE>";
//			requestRegistXml+="</HEAD>";
//			requestRegistXml+="<BODY>";
//			if(memberBaseInfo != null){
//				requestRegistXml+="<CUSTOMER_PASSWORD>"+memberBaseInfo.getPasswd()+"</CUSTOMER_PASSWORD>";
//				requestRegistXml+="<SCHOOL_NO>"+memberBaseInfo.getSchool().getCode()+"</SCHOOL_NO>";
//				requestRegistXml+="<CUSTOMER_NO>"+memberBaseInfo.getIdNumber()+"</CUSTOMER_NO>";
//				String name = "";
//				if(StringTools.hasText(memberBaseInfo.getName())){
//					name = java.net.URLEncoder.encode(memberBaseInfo.getName(), "utf-8");
//				}
//				requestRegistXml+="<CUSTOMER_NAME>"+name+"</CUSTOMER_NAME>";
//				requestRegistXml+="<USER_AGE>"+memberBaseInfo.getUserAge()+"</USER_AGE>";
//				requestRegistXml+="<CUSTOMER_MALE>";
//				requestRegistXml+=memberBaseInfo.getMale();//性别
//				requestRegistXml+="</CUSTOMER_MALE>";
//				requestRegistXml+="<CUSTOMER_EMAIL>"+memberBaseInfo.getEmail()+"</CUSTOMER_EMAIL>";
//				requestRegistXml+="<CUSTOMER_MOBILE>"+memberBaseInfo.getMobile()+"</CUSTOMER_MOBILE>";
//				requestRegistXml+="<STATUS>"+memberBaseInfo.getStatusStr()+"</STATUS>";
//				requestRegistXml+="<WEIGHT>"+memberBaseInfo.getWeightId()+"</WEIGHT>";
//				requestRegistXml+="<HEIGHT>"+memberBaseInfo.getHeight()+"</HEIGHT>";
//				requestRegistXml+="<OPEN_ID>"+memberBaseInfo.getOpenid()+"</OPEN_ID>";
//				requestRegistXml+="<ACTIVE>"+memberBaseInfo.getActive()+"</ACTIVE>";
//				requestRegistXml+="<LANGUAGE>"+memberBaseInfo.getZhOrEn()+"</LANGUAGE>";
//			}
//			requestRegistXml+="</BODY>";
//			requestRegistXml+="</ARAMARK_REQUEST>";
//			return requestRegistXml;
//		}
//
//
//
//		/**
//		 * 个人注册信息推送到订货总部后的返回信息的解析
//		 * */
//		public String resolveRegistInfo1(String requestRegistInfoXml){
//			String errorCode = "9900";
//			try {
//				Document doc = DocumentHelper.parseText(requestRegistInfoXml);
//				Element rootment = doc.getRootElement();// 获取根节点
//				if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
//					return  errorCode;
//				}else{
//					Element head = rootment.element("HEAD");
//					if(head == null ) return errorCode;
//
//					Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
//					if(RESPONSE_ELEMENT == null) return errorCode;
//
//					if("0000".equals(RESPONSE_ELEMENT.getTextTrim())){
//						Element BODY  = rootment.element("BODY");
//						if(BODY == null) return errorCode;
//
//						Element RESULT = BODY.element("responseCode");
//						if(RESULT == null) return errorCode;
//						return RESULT.getTextTrim();
//					}else{
//						Element RESPONSE_DESC = head.element("RESPONSE_DESC");
//						if(RESPONSE_DESC == null) return errorCode;
//						return RESPONSE_DESC.getTextTrim();
//					}
//				}
//			} catch (DocumentException e) {
//				e.printStackTrace();
//				return errorCode;
//			}
//		}
//
//

    /**
     * 个人注册信息推送到订货总部后的返回信息的解析
     *
     * @throws UnsupportedEncodingException
     */
    public Map<String, String> resolveRegistInfo(String requestRegistInfoXml) throws UnsupportedEncodingException {
        Map<String, String> map = new HashMap<String, String>();
        String errorCode = "9900";
        try {
            Document doc = DocumentHelper.parseText(requestRegistInfoXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                map.put(errorCode, "网络传输失败，回传时头部结点丢失");
                return map;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    map.put(errorCode, "网络传输失败，回传时头部结点丢失");
                    return map;
                }


                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    map.put(errorCode, "网络传输失败，回传时内容结点丢失");
                    return map;
                }
                Element responseDesc = head.element("RESPONSE_DESC");
                if (responseDesc == null) {
                    map.put(errorCode, "网络传输失败，回传时内容结点丢失");
                    return map;
                }
                Element BODY = rootment.element("BODY");
                if (BODY == null) {
                    map.put(errorCode, "网络传输失败，回传时内容结点丢失");
                    return map;
                }
                String mes = URLDecoder.decode(responseDesc.getTextTrim(), "utf-8");
                map.put(responseCode.getTextTrim(), mes);
                return map;
            }
        } catch (DocumentException e) {
            e.printStackTrace();
            map.put(errorCode, "解析失败");
            return map;
        }
    }

    //
    /*-----------------kongxc——根据手机号码到pos取餐个人信息-----------*/
    public String requestGetMemInfo(String iFPassWord, String education, String schoolCode, MemberBaseInfo memberBaseInfo) {

        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + iFPassWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + education + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>KONGXC001</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + schoolCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "<REQUEST_CONDITION>";
        requestRegistXml += "<CUSTOMER_MOBILE>" + memberBaseInfo.getMobile() + "</CUSTOMER_MOBILE>";
        requestRegistXml += "</REQUEST_CONDITION>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "</ARAMARK_REQUEST>";

        return requestRegistXml;
    }

    //	 /*-----------------kongxc——根据会员编号到pos获取今日消费订单-----------*/
    public String requestGetPosCon(String iFPassWord, String education, String schoolCode, MemberBaseInfo memberBaseInfo, String staTime, String endTime) {
        if (StringUtils.isEmpty(staTime) || StringUtils.isEmpty(endTime)) {
            Calendar c = Calendar.getInstance();
            staTime = TimeTools.calendar2String(TimeTools.startOfDay(c));
            endTime = TimeTools.calendar2String(TimeTools.endOfDay(c));
        }
        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + iFPassWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + education + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>KONGXC013</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + schoolCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "<REQUEST_CONDITION>";
        requestRegistXml += "<CUSTOMER_IDNUM>" + memberBaseInfo.getIdNumber() + "</CUSTOMER_IDNUM>";
        requestRegistXml += "<CUSTOMER_STRRTTIME>" + staTime + "</CUSTOMER_STRRTTIME>";
        requestRegistXml += "<CUSTOMER_END>" + endTime + "</CUSTOMER_END>";
        requestRegistXml += "</REQUEST_CONDITION>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "</ARAMARK_REQUEST>";
        return requestRegistXml;
    }

    //
//
//		 /*-----------------kongxc——根据idNumber获取今日订单解析-----------*/
    public String resolveGetTodCon(String requestRegistInfoXml) throws UnsupportedEncodingException {
        String errorCode = "9999";
        String errDes = "";
        try {
            Document doc = DocumentHelper.parseText(requestRegistInfoXml);
            Element rootment = doc.getRootElement();// 获取根节点

            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                errDes = "返回xml格式错误，没有头结点";
                return errDes;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    errDes = "返回xml格式错误，没有头部";
                    return errDes;
                }

                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    errDes = "返回xml没有编号";
                    return errDes;
                }
                if (!"0000".equals(responseCode.getTextTrim())) {
                    Element responseDesc = head.element("RESPONSE_DESC");
                    errDes = responseDesc.getTextTrim();
                    return errDes;
                }
                return responseCode.getTextTrim();
            }

        } catch (DocumentException e) {
            e.printStackTrace();
            return errorCode;
        }
    }

    //
//		 /*-----------------kongxc——根据idNumber获取今日订单解析-----------*/
    public List<OrderOfDaynut> resolveGetTodConDet(String requestRegistInfoXml) throws UnsupportedEncodingException {
        List<OrderOfDaynut> list = new ArrayList<OrderOfDaynut>();
        try {
            Document doc = DocumentHelper.parseText(requestRegistInfoXml);
            Element rootment = doc.getRootElement();// 获取根节点
            Element BODY = rootment.element("BODY");
            @SuppressWarnings("unchecked")
            List<Element> elementList = BODY.elements("CON_ORDER_MAIN");
            for (Element element : elementList) {
//                if (element.element("ORDER_MAIN_REASON").getText().contains("线上订单消费")) continue;
                OrderOfDaynut orderOfDaynut = new OrderOfDaynut();
                orderOfDaynut.setOrderCode((element.element("ORDER_MAIN_CODE").getText()));
//                if (list.contains(orderOfDaynut)) {
//                    orderOfDaynut = list.stream().filter(i -> i.getOrderCode().equals(element.element("ORDER_MAIN_CODE").getText())).collect(Collectors.toList()).get(0);
//                    orderOfDaynut.setActualAmount(Double.parseDouble(orderOfDaynut.getActualAmount()) + Double.parseDouble(element.element("ORDER_MAIN_ACLPAY").getText()) + "");
//                    @SuppressWarnings("unchecked")
//                    List<Element> elementDetList = element.elements("CON_ORDER_DET");
//                    for (Element element2 : elementDetList) {
//                        for (OrderOfDaynut orderOfDaynut2 : orderOfDaynut.getList()) {
//                            if (element2.element("CON_ORDER_FOOD_NAME").getTextTrim().equals(orderOfDaynut2.getResourseName())) {
//                                orderOfDaynut2.setQuantity(Double.valueOf(element2.element("CON_ORDER_FOOD_QUA").getTextTrim()));
//                            }
//                        }
//                    }
//                } else {
                orderOfDaynut.setConTimeStr((element.element("ORDER_MAIN_CONTIME").getText()));
                orderOfDaynut.setHasPay(element.element("ORDER_MAIN_SET").getText());
                orderOfDaynut.setActualAmount((element.element("ORDER_MAIN_ACLPAY").getText()));
                orderOfDaynut.setTotalPrice((element.element("ORDER_MAIN_PAY").getText()));
                orderOfDaynut.setDiscountAmount((element.element("ORDER_MAIN_DISCOUNT").getText()));
                orderOfDaynut.setMealName((element.element("ORDER_MAIN_MEA").getText()));
                orderOfDaynut.setOrderType((element.element("ORDER_MAIN_TYPE").getText()));
                orderOfDaynut.setOrderStatus((element.element("ORDER_MAIN_STATUS").getText()));
                orderOfDaynut.setSortTime(orderOfDaynut.getConTimeStr());
                @SuppressWarnings("unchecked")
                List<Element> elementDetList = element.elements("CON_ORDER_DET");
                List<OrderOfDaynut> list2 = new ArrayList<OrderOfDaynut>();
                for (Element element2 : elementDetList) {
                    OrderOfDaynut orderOfDaynut2 = new OrderOfDaynut();
                    orderOfDaynut2.setResourseName(element2.element("CON_ORDER_FOOD_NAME").getTextTrim());
                    orderOfDaynut2.setResourseNameEn(element2.element("CON_ORDER_FOOD_NAM_EN").getTextTrim());
                    orderOfDaynut2.setPrice(Double.valueOf(element2.element("CON_ORDER_FOOD_PRI").getTextTrim()));
                    orderOfDaynut2.setQuantity(Double.valueOf(element2.element("CON_ORDER_FOOD_QUA").getTextTrim()));
                    list2.add(orderOfDaynut2);
                }
                orderOfDaynut.setList(list2);

                list.add(orderOfDaynut);
//                }
            }
            return list;
        } catch (DocumentException e) {
            e.printStackTrace();
            return null;
        }
    }

    /*-----------------kongxc——根据手机号码到pos取餐个人信息的POS回调解析-----------*/
    public MemberBaseInfo resolveGetMemInfo(String requestRegistInfoXml) throws UnsupportedEncodingException {

        String errorCode = "9999";
        MemberBaseInfo memberBaseInfo = new MemberBaseInfo();
        try {
            Document doc = DocumentHelper.parseText(requestRegistInfoXml);
            Element rootment = doc.getRootElement();// 获取根节点

            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                memberBaseInfo.setResponseCode(errorCode);
                memberBaseInfo.setResponseDesc("返回xml格式错误，没有头结点");
                return memberBaseInfo;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    memberBaseInfo.setResponseCode(errorCode);
                    memberBaseInfo.setResponseDesc("返回xml格式错误，没有头部");
                    return memberBaseInfo;
                }

                Element responseCode = head.element("RESPONSE_CODE");
                if (responseCode == null) {
                    memberBaseInfo.setResponseCode(errorCode);
                    memberBaseInfo.setResponseDesc("返回xml没有编号");
                    return memberBaseInfo;
                }
                if (!"0000".equals(responseCode.getTextTrim())) {
                    Element responseDesc = head.element("RESPONSE_DESC");
                    memberBaseInfo.setResponseCode(responseCode.getTextTrim());
                    memberBaseInfo.setResponseDesc(responseDesc.getTextTrim());
                    return memberBaseInfo;
                }
                if (responseCode != null && "0000".equals(responseCode.getTextTrim())) {
                    Element body = rootment.element("BODY");
                    if (body == null) {
                        memberBaseInfo.setResponseCode(errorCode);
                        memberBaseInfo.setResponseDesc("返回没有信息，网络繁忙。。");
                        return memberBaseInfo;
                    }

                    Element result = body.element("RESULT");
                    if (result == null || "9999".equals(result.getTextTrim())) {
                        memberBaseInfo.setResponseCode(result.getTextTrim());
                        memberBaseInfo.setResponseDesc("返回错误");
                        return memberBaseInfo;
                    } else if (result != null || "0000".equals(result.getTextTrim())) {
                        memberBaseInfo.setResponseCode(result.getTextTrim());
                        Element customerNo = body.element("CUSTOMER_NO");
                        if (customerNo != null && customerNo.getTextTrim() != null) {
                            memberBaseInfo.setIdNumber(customerNo.getTextTrim());
                        }
                        Element name = body.element("NAME");
                        if (name != null && name.getTextTrim() != null) {
                            memberBaseInfo.setName(name.getTextTrim());
                        }
                        Element mail = body.element("MAIL");
                        if (mail != null && mail.getTextTrim() != null) {
                            memberBaseInfo.setMale("1".equals(mail.getTextTrim()) ? "1" : "0");
                        }
                        Element email = body.element("EMAIL");
                        if (email != null && email.getTextTrim() != null) {
                            memberBaseInfo.setEmail(email.getTextTrim());
                        }
                        Element mobile = body.element("MOBILE");
                        if (mobile != null && mobile.getTextTrim() != null) {
                            memberBaseInfo.setMobile(mobile.getTextTrim());
                        }
                        Element password = body.element("PASSWORD");
                        if (password != null && password.getTextTrim() != null) {
                            memberBaseInfo.setPasswd(password.getTextTrim());
                        }
                        Element id = body.element("PASSWORD");
                        if (id != null && id.getTextTrim() != null) {
                            memberBaseInfo.setId(id.getTextTrim());
                        }
                        Element status = body.element("STATUS");
                        if (status != null && status.getTextTrim() != null) {
                            memberBaseInfo.setStatusStr(status.getTextTrim());
                        }
                        Element customerType = body.element("CUSTOMER_TYPE");
                        if (customerType != null && StringUtils.hasText(customerType.getTextTrim())) {
                            memberBaseInfo.setCustomerType(customerType.getTextTrim());
                        }
                        Element morningMinMum = body.element("MORNING_MINIMUM");
                        if (morningMinMum != null && morningMinMum.getTextTrim() != null) {
                            memberBaseInfo.setMorningMinMum(Double.valueOf(morningMinMum.getTextTrim()));
                        }
                        Element afternoonMinMum = body.element("AFTERNOON_MINIMUM");
                        if (afternoonMinMum != null && afternoonMinMum.getTextTrim() != null) {
                            memberBaseInfo.setAfternoonMinMum(Double.valueOf(afternoonMinMum.getTextTrim()));
                        }
                        Element evenningMinMum = body.element("EVENING_MINIMUM");
                        if (evenningMinMum != null && evenningMinMum.getTextTrim() != null) {
                            memberBaseInfo.setEvenningMinMum(Double.valueOf(evenningMinMum.getTextTrim()));
                        }
                        Element morningAllowance = body.element("MORNING_ALLOWANCE");
                        if (morningAllowance != null && morningAllowance.getTextTrim() != null) {
                            memberBaseInfo.setMorningAllowance(Double.valueOf(morningAllowance.getTextTrim()));
                        }
                        Element afternoonAllowance = body.element("AFTERNOON_ALLOWANCE");
                        if (afternoonAllowance != null && afternoonAllowance.getTextTrim() != null) {
                            memberBaseInfo.setAfternoonAllowance(Double.valueOf(afternoonAllowance.getTextTrim()));
                        }
                        Element eveningAllowance = body.element("EVENING_ALLOWANCE");
                        if (eveningAllowance != null && eveningAllowance.getTextTrim() != null) {
                            memberBaseInfo.setEvenningAllowance(Double.valueOf(eveningAllowance.getTextTrim()));
                        }
                    }
                    return memberBaseInfo;
                } else {
                    memberBaseInfo.setResponseCode(errorCode);
                    return memberBaseInfo;
                }
            }
        } catch (DocumentException e) {
            e.printStackTrace();
            memberBaseInfo.setResponseCode(errorCode);
            return memberBaseInfo;
        }
    }
//
//
//

    /**
     * 个人注册信息绑定开通餐卡
     * <ARAMARK_REQUEST>
     * <HEAD>
     * <VERSION></VERSION>
     * <REQUEST_TYPE></REQUEST_TYPE>
     * <PROJECT_CODE></PROJECT_CODE>
     * <REQUEST_CUS></REQUEST_CUS>
     * <PASSWORD></PASSWORD>
     * <REQUEST_UNIQUE></REQUEST_UNIQUE>
     * </HEAD>
     * </ARAMARK_REQUEST>
     */
//		public String  requestRegistInfo1(String passWord,String education,String projectCode,MemberBaseInfo memberBaseInfo){
//
//			String requestRegistXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//			requestRegistXml+="<ARAMARK_REQUEST>";
//			requestRegistXml+="<HEAD>";
//			requestRegistXml+="<REQUEST_TYPE>ZC001</REQUEST_TYPE>";
//			requestRegistXml+="<VERSION>1.0</VERSION>";
//			requestRegistXml+="<PROJECT_CODE>"+projectCode+"</PROJECT_CODE>";
//			requestRegistXml+="<PASSWORD>"+passWord+"</PASSWORD>";
//			requestRegistXml+="<REQUEST_CUS>"+education+"</REQUEST_CUS>";
//			requestRegistXml+="<REQUEST_UNIQUE>"+UUID.randomUUID().toString().replace("-", "")+"</REQUEST_UNIQUE>";
//			requestRegistXml+="<BODY>";
//				requestRegistXml+="<CUSTOMER_NO>"+memberBaseInfo.getIdNumber()+"</CUSTOMER_NO>";
//				requestRegistXml+="<CUSTOMER_NAME>"+memberBaseInfo.getName()+"</CUSTOMER_NAME>";
//				requestRegistXml+="<CUSTOMER_PASSWORD>"+memberBaseInfo.getZfPasswd()+"</CUSTOMER_PASSWORD>";
//				requestRegistXml+="<CUSTOMER_MALE>";
//				requestRegistXml+=memberBaseInfo.getMale();//性别
//				requestRegistXml+="</CUSTOMER_MALE>";
//				requestRegistXml+="<CUSTOMER_EMAIL>"+memberBaseInfo.getEmail()+"</CUSTOMER_EMAIL>";
//				requestRegistXml+="<CUSTOMER_MOBILE>"+memberBaseInfo.getMobile()+"</CUSTOMER_MOBILE>";
//				requestRegistXml+="<OPEN_ID>"+memberBaseInfo.getOpenid()+"</OPEN_ID>";
//				requestRegistXml+="<CUSTOMER_TEL></CUSTOMER_TEL>";
//			requestRegistXml+="</BODY>";
//			requestRegistXml+="</HEAD>";
//			requestRegistXml+="</ARAMARK_REQUEST>";
//			return requestRegistXml;
//		}
//
//
//	//DD001
//		public String  requestOrderInfo(String iFPassWord, String education, String educationCode, OrderMainInfo orderMainInfo, List<OrderDetailInfo> detailList, String isPay){
//
//			String requestRegistXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//			requestRegistXml+="<ARAMARK_REQUEST>";
//			requestRegistXml+="<HEAD>";
//			requestRegistXml+="<VERSION>1.0</VERSION>";
//			requestRegistXml+="<PASSWORD>"+iFPassWord+"</PASSWORD>";
//			requestRegistXml+="<REQUEST_CUS>"+education+"</REQUEST_CUS>";
//			requestRegistXml+="<REQUEST_TYPE>DD001</REQUEST_TYPE>";
//			requestRegistXml+="<PROJECT_CODE>"+educationCode+"</PROJECT_CODE>";
//			requestRegistXml+="<REQUEST_UNIQUE>"+UUID.randomUUID().toString().replace("-", "")+"</REQUEST_UNIQUE>";
//			requestRegistXml+="</HEAD>";
//			requestRegistXml+="<BODY>";
//			requestRegistXml+="<REQUEST_ORDER>";
//			requestRegistXml+="<CUSTOMER_NO>"+orderMainInfo.getMemberInfo().getIdNumber()+"</CUSTOMER_NO>";
//			requestRegistXml+="<CUSTOMER_NAME>"+orderMainInfo.getMemberInfo().getName()+"</CUSTOMER_NAME>";
//			requestRegistXml+="<SUBMIT_TIME>"+TimeTools.calendar2String(orderMainInfo.getCreateTime(),"yyyy-MM-dd HH:mm:ss")+"</SUBMIT_TIME> "; // 查询日期节点不存在   查询日期不能为空  日期格式错误
//			requestRegistXml+="<ORDER_CODE>"+orderMainInfo.getCode()+"</ORDER_CODE> ";
//			requestRegistXml+="<ORDER_AMOUNT>"+orderMainInfo.getSumAmount()+"</ORDER_AMOUNT> ";
//			requestRegistXml+="<ORDER_TYPE>";
//			requestRegistXml+=orderMainInfo.getOrderType();
//			requestRegistXml+="</ORDER_TYPE> ";//订单类型，自取，送货上门
//			requestRegistXml+="<ORDER_STATUS>"+orderMainInfo.getStatus()+"</ORDER_STATUS> ";//未打印 备餐中 已打印 交易成功 交易失败 已销毁
//			requestRegistXml+="<ORDER_PROVIDER>"+orderMainInfo.getPrepareer()+"</ORDER_PROVIDER> ";//备餐人
//			requestRegistXml+="<PROVIDE_TIME>"+TimeTools.calendar2String(orderMainInfo.getPrepareTime(), "yyyy-MM-dd HH:mm:ss")+"</PROVIDE_TIME> ";
//			requestRegistXml+="<ORDER_PRINTER>"+orderMainInfo.getPrinter()+"</ORDER_PRINTER> ";//订单打印人
//			requestRegistXml+="<PRINT_TIME>"+TimeTools.calendar2String(orderMainInfo.getPrintTime(), "yyyy-MM-dd HH:mm:ss")+"</PRINT_TIME> ";//订单打印时间
//			requestRegistXml+="<ORDER_DESTROYER>"+orderMainInfo.getDestroyer()+"</ORDER_DESTROYER> ";//订单撤销人
//			requestRegistXml+="<DESTORY_TIME>"+TimeTools.calendar2String(orderMainInfo.getDestroyTime(),"yyyy-MM-dd HH:mm:ss")+"</DESTORY_TIME> ";//订单撤销时间
//			requestRegistXml+="<IS_PAY>"+isPay+"</IS_PAY>";//是否支付，1已经支付，0未支付
//			if(detailList!=null && detailList.size()>0){
//				requestRegistXml+="<REQUEST_ITEMS> ";
//				for(OrderDetailInfo odf:detailList){
//					requestRegistXml+="<REQUEST_ITEM> ";
//					requestRegistXml+="<ITEM_CODE>"+odf.getFoodPrice().getFood().getCode()+"</ITEM_CODE> ";
////					requestRegistXml+="<ITEM_CODE>SP001</ITEM_CODE> ";
//					requestRegistXml+="<ITEM_QUALITY>"+odf.getQuantity()+"</ITEM_QUALITY> ";
//					requestRegistXml+="<ITEM_PRICE>"+odf.getFoodPrice().getPrice()+"</ITEM_PRICE> ";
//					requestRegistXml+="<ITEM_AMOUNT>"+odf.getPrice()+"</ITEM_AMOUNT> ";
//					requestRegistXml+="</REQUEST_ITEM> ";
//				}
//				requestRegistXml+="</REQUEST_ITEMS> ";
//			}
//			requestRegistXml+="</REQUEST_ORDER>";
//			requestRegistXml+="</BODY>";
//			requestRegistXml+="</ARAMARK_REQUEST>";
//
//			return requestRegistXml;
//		}
//
//
    public String requestCPOrderInfoKongxc(String passWord, String proName, String proCode,
                                           MemberBaseInfo loginUser, CoursesOrders order, List<CoursesOrdersDetails> detailList, String isPay, String chuzhika_num, String reason) throws UnsupportedEncodingException {

        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + passWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + proName + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>DD001</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + proCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "<BODY>";
        requestRegistXml += "<REQUEST_ORDER>";
        requestRegistXml += "<CUSTOMER_NO>" + loginUser.getIdNumber() + "</CUSTOMER_NO>";
        requestRegistXml += "<PATIENT_NUMBER>" + order.getPatientNumber() + "</PATIENT_NUMBER>";
        requestRegistXml += "<CUSTOMER_ACCOUNT_TYPE>" + chuzhika_num + "</CUSTOMER_ACCOUNT_TYPE>";
        requestRegistXml += "<CUSTOMER_NAME>" + encode(order.getPayMemberName(), "utf-8") + "</CUSTOMER_NAME>";
        requestRegistXml += "<CUSTOMER_PHONE>" + order.getMobile() + "</CUSTOMER_PHONE>";
        requestRegistXml += "<SUBMIT_TIME>" + TimeTools.localDateTime2String(order.getTakeTime(), "yyyy-MM-dd HH:mm:ss") + "</SUBMIT_TIME> "; // 查询日期节点不存在   查询日期不能为空  日期格式错误
        requestRegistXml += "<ORDER_CODE>" + order.getOrderCode() + "</ORDER_CODE> ";
        requestRegistXml += "<ORDER_AMOUNT>" + order.getAmount() + "</ORDER_AMOUNT> ";
        requestRegistXml += "<ORDER_TYPE>" + order.getOrderType() + "</ORDER_TYPE>";//订单类型，自取，送货上门
        requestRegistXml += "<MEAL_CODE>" + order.getMealCode() + "</MEAL_CODE>";//餐次
        requestRegistXml += "<TAKE_MEAL_TYPE>" + order.getTakeMealType() + "</TAKE_MEAL_TYPE>";//取餐类型
        requestRegistXml += "<ORDER_STATUS>YZF</ORDER_STATUS> ";//未打印 备餐中 已打印 交易成功 交易失败 已销毁
        requestRegistXml += "<TABLE_NO>" + order.getTakeCode() + "</TABLE_NO>";
        requestRegistXml += "<REMARK>" + encode(order.getRemark(), "utf-8") + "</REMARK> ";
        if (order.getAddressDetail() != null) {
            requestRegistXml += "<RECEIVE_ADDRESS>" + encode(order.getAddressDetail(), "utf-8") + "</RECEIVE_ADDRESS> ";
            if (StringUtils.isEmpty(order.getArchitecture())) {
                requestRegistXml += "<ARCHITECTURE>" + encode(order.getAddressDetail().split(",")[0], "utf-8") + "</ARCHITECTURE> ";
            } else {
                requestRegistXml += "<ARCHITECTURE>" + encode(order.getArchitecture(), "utf-8") + "</ARCHITECTURE> ";
            }
        } else {
            requestRegistXml += "<RECEIVE_ADDRESS>" + encode(loginUser.getRestaurant().getNameZh(), "utf-8") + "</RECEIVE_ADDRESS> ";
            requestRegistXml += "<ARCHITECTURE>" + encode(loginUser.getRestaurant().getNameZh(), "utf-8") + "</ARCHITECTURE> ";
        }
        requestRegistXml += "<DISCOUNT_AMOUNT>" + loginUser.getAllowanceAmount() + "</DISCOUNT_AMOUNT> ";
        requestRegistXml += "<MAX_DISCOUNT_AMOUNT>" + loginUser.getMaxAllowance() + "</MAX_DISCOUNT_AMOUNT> ";
        requestRegistXml += "<ORDER_PROVIDER>" + "admin" + "</ORDER_PROVIDER> ";//备餐人
        requestRegistXml += "<PROVIDE_TIME>" + TimeTools.localDateTime2String(order.getPrintTime(), "yyyy-MM-dd HH:mm:ss") + "</PROVIDE_TIME> ";
        requestRegistXml += "<ORDER_PRINTER>" + "admin" + "</ORDER_PRINTER> ";//订单打印人
        requestRegistXml += "<PRINT_TIME>" + TimeTools.localDateTime2String(order.getBhTime(), "yyyy-MM-dd HH:mm:ss") + "</PRINT_TIME> ";//订单打印时间
        requestRegistXml += "<ORDER_DESTROYER>" + "admin" + "</ORDER_DESTROYER> ";//订单撤销人
        requestRegistXml += "<DESTORY_TIME>" + TimeTools.localDateTime2String(order.getCompletedTime(), "yyyy-MM-dd HH:mm:ss") + "</DESTORY_TIME> ";//订单撤销时间
        requestRegistXml += "<IS_PAY>" + isPay + "</IS_PAY>";//是否支付，1已经支付，0未支付
        reason = encode("线上订单消费(" + reason + ")", "utf-8");
        requestRegistXml += "<REASON>" + reason + "</REASON>";
        if (detailList != null && detailList.size() > 0) {
            requestRegistXml += "<REQUEST_ITEMS> ";
            for (CoursesOrdersDetails odf : detailList) {
                requestRegistXml += "<REQUEST_ITEM> ";
                requestRegistXml += "<ITEM_CODE>" + odf.getCourse().getPosNo() + "</ITEM_CODE> ";
                requestRegistXml += "<ITEM_NAMEZH>" + encode(odf.getCourse().getNameCh(), "utf-8") + "</ITEM_NAMEZH> ";
                if (StringUtils.hasText(odf.getCourse().getNameEn())) {
                    requestRegistXml += "<ITEM_NAMEEN>" + encode(odf.getCourse().getNameEn(), "utf-8") + "</ITEM_NAMEEN> ";
                } else {
                    requestRegistXml += "<ITEM_NAMEEN>" + encode(odf.getCourse().getNameCh(), "utf-8") + "</ITEM_NAMEEN> ";
                }
                requestRegistXml += "<ITEM_QUALITY>" + odf.getQuantity().intValue() + "</ITEM_QUALITY> ";
                requestRegistXml += "<ITEM_PRICE>" + odf.getPrice() + "</ITEM_PRICE> ";
                requestRegistXml += "<ITEM_AMOUNT>" + odf.getPrice() * odf.getQuantity() + "</ITEM_AMOUNT> ";
                requestRegistXml += "<BUSINESS_CODE>" + odf.getCourse().getBusinessCode() + "</BUSINESS_CODE> ";
                requestRegistXml += "</REQUEST_ITEM> ";
            }
            requestRegistXml += "</REQUEST_ITEMS> ";
        }
        requestRegistXml += "</REQUEST_ORDER>";
        requestRegistXml += "</BODY>";
        requestRegistXml += "</ARAMARK_REQUEST>";

        return requestRegistXml;
    }

    public String requestOrderInfoKongxc(String passWord, String proName, String proCode, MemberBaseInfo loginUser, CoursesOrders order, List<CoursesOrdersDetails> detailList, double payProportion, Double amount, int isPay, String chuzhika_num, String reason) throws UnsupportedEncodingException {
        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + passWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + proName + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>DD001</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + proCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "<BODY>";
        requestRegistXml += "<REQUEST_ORDER>";
        requestRegistXml += "<CUSTOMER_ACCOUNT_TYPE>" + chuzhika_num + "</CUSTOMER_ACCOUNT_TYPE>";
        if (isPay == 1) {
            requestRegistXml += "<CUSTOMER_NO>PUBLIC</CUSTOMER_NO>";
            requestRegistXml += "<CUSTOMER_NAME>" + encode("优惠账户", "utf-8") + "</CUSTOMER_NAME>";
            requestRegistXml += "<CUSTOMER_PHONE>null</CUSTOMER_PHONE>";
        } else {
            requestRegistXml += "<CUSTOMER_NO>" + loginUser.getIdNumber() + "</CUSTOMER_NO>";
            requestRegistXml += "<CUSTOMER_NAME>" + encode(order.getPayMemberName(), "utf-8") + "</CUSTOMER_NAME>";
            requestRegistXml += "<CUSTOMER_PHONE>" + order.getMobile() + "</CUSTOMER_PHONE>";
        }
        requestRegistXml += "<SUBMIT_TIME>" + TimeTools.localDateTime2String(order.getTakeTime(), "yyyy-MM-dd HH:mm:ss") + "</SUBMIT_TIME> "; // 查询日期节点不存在   查询日期不能为空  日期格式错误
        requestRegistXml += "<ORDER_CODE>" + order.getOrderCode() + "</ORDER_CODE> ";
        requestRegistXml += "<ORDER_AMOUNT>" + amount + "</ORDER_AMOUNT> ";
        requestRegistXml += "<ORDER_TYPE>" + order.getOrderType() + "</ORDER_TYPE>";//订单类型，自取，送货上门
        requestRegistXml += "<MEAL_CODE>" + order.getMealCode() + "</MEAL_CODE>";//餐次
        requestRegistXml += "<ORDER_STATUS>YZF</ORDER_STATUS> ";//未打印 备餐中 已打印 交易成功 交易失败 已销毁
        requestRegistXml += "<TAKE_MEAL_TYPE>" + order.getTakeMealType() + "</TAKE_MEAL_TYPE>";//取餐类型
        requestRegistXml += "<TABLE_NO>" + order.getTakeCode() + "</TABLE_NO>";
        requestRegistXml += "<REMARK>" + encode(order.getRemark(), "utf-8") + "</REMARK> ";

        if (order.getAddressDetail() != null) {
            requestRegistXml += "<RECEIVE_ADDRESS>" + encode(order.getAddressDetail(), "utf-8") + "</RECEIVE_ADDRESS> ";
            if (StringUtils.isEmpty(order.getArchitecture())) {
                requestRegistXml += "<ARCHITECTURE>" + encode(order.getAddressDetail().split(",")[0], "utf-8") + "</ARCHITECTURE> ";
            } else {
                requestRegistXml += "<ARCHITECTURE>" + encode(order.getArchitecture(), "utf-8") + "</ARCHITECTURE> ";
            }
        } else {
            requestRegistXml += "<RECEIVE_ADDRESS>" + encode(loginUser.getRestaurant().getNameZh(), "utf-8") + "</RECEIVE_ADDRESS> ";
            requestRegistXml += "<ARCHITECTURE>" + encode(loginUser.getRestaurant().getNameZh(), "utf-8") + "</ARCHITECTURE> ";
        }
        requestRegistXml += "<DISCOUNT_AMOUNT>" + loginUser.getAllowanceAmount() * payProportion + "</DISCOUNT_AMOUNT> ";
        requestRegistXml += "<MAX_DISCOUNT_AMOUNT>" + loginUser.getMaxAllowance() + "</MAX_DISCOUNT_AMOUNT> ";
        requestRegistXml += "<ORDER_PROVIDER>" + "admin" + "</ORDER_PROVIDER> ";//备餐人
        requestRegistXml += "<PROVIDE_TIME>" + TimeTools.localDateTime2String(order.getPrintTime(), "yyyy-MM-dd HH:mm:ss") + "</PROVIDE_TIME> ";
        requestRegistXml += "<ORDER_PRINTER>" + "admin" + "</ORDER_PRINTER> ";//订单打印人
        requestRegistXml += "<PRINT_TIME>" + TimeTools.localDateTime2String(order.getBhTime(), "yyyy-MM-dd HH:mm:ss") + "</PRINT_TIME> ";//订单打印时间
        requestRegistXml += "<ORDER_DESTROYER>" + "admin" + "</ORDER_DESTROYER> ";//订单撤销人
        requestRegistXml += "<DESTORY_TIME>" + TimeTools.localDateTime2String(order.getCompletedTime(), "yyyy-MM-dd HH:mm:ss") + "</DESTORY_TIME> ";//订单撤销时间
        requestRegistXml += "<IS_PAY>" + isPay + "</IS_PAY>";//是否支付，1已经支付，0未支付
        reason = encode("线上订单消费(" + reason + ")", "utf-8");
        requestRegistXml += "<REASON>" + reason + "</REASON>";
        if (detailList != null && detailList.size() > 0) {
            requestRegistXml += "<REQUEST_ITEMS> ";
            for (CoursesOrdersDetails odf : detailList) {
                requestRegistXml += "<REQUEST_ITEM> ";
                requestRegistXml += "<ITEM_CODE>" + odf.getCourse().getPosNo() + "</ITEM_CODE> ";
                requestRegistXml += "<ITEM_NAMEZH>" + encode(odf.getCourse().getNameCh(), "utf-8") + "</ITEM_NAMEZH> ";
                if (StringUtils.hasText(odf.getCourse().getNameEn())) {
                    requestRegistXml += "<ITEM_NAMEEN>" + encode(odf.getCourse().getNameEn(), "utf-8") + "</ITEM_NAMEEN> ";
                } else {
                    requestRegistXml += "<ITEM_NAMEEN>" + encode(odf.getCourse().getNameCh(), "utf-8") + "</ITEM_NAMEEN> ";
                }
                requestRegistXml += "<ITEM_QUALITY>" + odf.getQuantity().intValue() * payProportion + "</ITEM_QUALITY> ";
                requestRegistXml += "<ITEM_PRICE>" + odf.getPrice() + "</ITEM_PRICE> ";
                requestRegistXml += "<ITEM_AMOUNT>" + odf.getPrice() * odf.getQuantity() * payProportion + "</ITEM_AMOUNT> ";
                requestRegistXml += "<BUSINESS_CODE>" + odf.getCourse().getBusinessCode() + "</BUSINESS_CODE> ";
                requestRegistXml += "</REQUEST_ITEM> ";
            }
            requestRegistXml += "</REQUEST_ITEMS> ";
        }
        requestRegistXml += "</REQUEST_ORDER>";
        requestRegistXml += "</BODY>";
        requestRegistXml += "</ARAMARK_REQUEST>";

        return requestRegistXml;
    }

    /**
     * 刷卡混合支付
     *
     * @param passWord
     * @param proName
     * @param proCode
     * @param loginUser
     * @param order
     * @param detailList
     * @param isPay
     * @param chuzhika_num
     * @param reason
     * @return
     * @throws UnsupportedEncodingException
     */
    public String combinedPaymentByCreditCard(String passWord, String proName, String proCode,
                                              MemberBaseInfo loginUser,
                                              CoursesOrders order,
                                              List<CoursesOrdersDetails> detailList,
                                              Double allowancePayProportion,
                                              Double storePayProportion) throws UnsupportedEncodingException {

        String requestRegistXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        requestRegistXml += "<ARAMARK_REQUEST>";
        requestRegistXml += "<HEAD>";
        requestRegistXml += "<VERSION>1.0</VERSION>";
        requestRegistXml += "<PASSWORD>" + passWord + "</PASSWORD>";
        requestRegistXml += "<REQUEST_CUS>" + proName + "</REQUEST_CUS>";
        requestRegistXml += "<REQUEST_TYPE>DD003</REQUEST_TYPE>";
        requestRegistXml += "<PROJECT_CODE>" + proCode + "</PROJECT_CODE>";
        requestRegistXml += "<REQUEST_UNIQUE>" + UUID.randomUUID().toString().replace("-", "") + "</REQUEST_UNIQUE>";
        requestRegistXml += "</HEAD>";
        requestRegistXml += "<BODY>";
        requestRegistXml += "<REQUEST_ORDER>";
        requestRegistXml += "<CUSTOMER_NO>" + loginUser.getIdNumber() + "</CUSTOMER_NO>";
        requestRegistXml += "<PATIENT_NUMBER>" + order.getPatientNumber() + "</PATIENT_NUMBER>";
        requestRegistXml += "<CUSTOMER_NAME>" + encode(order.getPayMemberName(), "utf-8") + "</CUSTOMER_NAME>";
        requestRegistXml += "<CUSTOMER_PHONE>" + order.getMobile() + "</CUSTOMER_PHONE>";
        requestRegistXml += "<SUBMIT_TIME>" + TimeTools.localDateTime2String(order.getTakeTime(), "yyyy-MM-dd HH:mm:ss") + "</SUBMIT_TIME> ";
        requestRegistXml += "<ORDER_CODE>" + order.getOrderCode() + "</ORDER_CODE> ";
        requestRegistXml += "<ORDER_AMOUNT>" + order.getAmount() + "</ORDER_AMOUNT> ";
        requestRegistXml += "<ORDER_TYPE>" + order.getOrderType() + "</ORDER_TYPE>";//订单类型，自取，送货上门
        requestRegistXml += "<MEAL_CODE>" + order.getMealCode() + "</MEAL_CODE>";//餐次
        requestRegistXml += "<TAKE_MEAL_TYPE>" + order.getTakeMealType() + "</TAKE_MEAL_TYPE>";//取餐类型
        requestRegistXml += "<ORDER_STATUS>YZF</ORDER_STATUS> ";//未打印 备餐中 已打印 交易成功 交易失败 已销毁
        requestRegistXml += "<TABLE_NO>" + order.getTakeCode() + "</TABLE_NO>";
        requestRegistXml += "<REMARK>" + encode(order.getRemark(), "utf-8") + "</REMARK> ";
        if (order.getAddressDetail() != null) {
            requestRegistXml += "<RECEIVE_ADDRESS>" + encode(order.getAddressDetail(), "utf-8") + "</RECEIVE_ADDRESS> ";
            if (StringUtils.isEmpty(order.getArchitecture())) {
                requestRegistXml += "<ARCHITECTURE>" + encode(order.getAddressDetail().split(",")[0], "utf-8") + "</ARCHITECTURE> ";
            } else {
                requestRegistXml += "<ARCHITECTURE>" + encode(order.getArchitecture(), "utf-8") + "</ARCHITECTURE> ";
            }
        } else {
            requestRegistXml += "<RECEIVE_ADDRESS>" + encode(loginUser.getRestaurant().getNameZh(), "utf-8") + "</RECEIVE_ADDRESS> ";
            requestRegistXml += "<ARCHITECTURE>" + encode(loginUser.getRestaurant().getNameZh(), "utf-8") + "</ARCHITECTURE> ";
        }
        requestRegistXml += "<ALLOWANCE_PAY_PROPORTION>" + allowancePayProportion + "</ALLOWANCE_PAY_PROPORTION> ";
        requestRegistXml += "<STORE_PAY_PROPORTION>" + storePayProportion + "</STORE_PAY_PROPORTION> ";
        requestRegistXml += "<DISCOUNT_AMOUNT>" + loginUser.getAllowanceAmount() + "</DISCOUNT_AMOUNT> ";
        requestRegistXml += "<MAX_DISCOUNT_AMOUNT>" + loginUser.getMaxAllowance() + "</MAX_DISCOUNT_AMOUNT> ";
        requestRegistXml += "<ORDER_PROVIDER>" + "admin" + "</ORDER_PROVIDER> ";//备餐人
        requestRegistXml += "<PROVIDE_TIME>" + TimeTools.localDateTime2String(order.getPrintTime(), "yyyy-MM-dd HH:mm:ss") + "</PROVIDE_TIME> ";
        requestRegistXml += "<ORDER_PRINTER>" + "admin" + "</ORDER_PRINTER> ";//订单打印人
        requestRegistXml += "<PRINT_TIME>" + TimeTools.localDateTime2String(order.getBhTime(), "yyyy-MM-dd HH:mm:ss") + "</PRINT_TIME> ";//订单打印时间
        requestRegistXml += "<ORDER_DESTROYER>" + "admin" + "</ORDER_DESTROYER> ";//订单撤销人
        requestRegistXml += "<DESTORY_TIME>" + TimeTools.localDateTime2String(order.getCompletedTime(), "yyyy-MM-dd HH:mm:ss") + "</DESTORY_TIME> ";//订单撤销时间
        requestRegistXml += "<IS_PAY>0</IS_PAY>";//是否支付，1已经支付，0未支付
        requestRegistXml += "<REASON>" + encode("刷卡支付(混合支付)", "utf-8") + "</REASON>";
        if (detailList != null && detailList.size() > 0) {
            requestRegistXml += "<REQUEST_ITEMS> ";
            for (CoursesOrdersDetails odf : detailList) {
                requestRegistXml += "<REQUEST_ITEM> ";
                requestRegistXml += "<ITEM_CODE>" + odf.getCourse().getPosNo() + "</ITEM_CODE> ";
                requestRegistXml += "<ITEM_NAMEZH>" + encode(odf.getCourse().getNameCh(), "utf-8") + "</ITEM_NAMEZH> ";
                if (StringUtils.hasText(odf.getCourse().getNameEn())) {
                    requestRegistXml += "<ITEM_NAMEEN>" + encode(odf.getCourse().getNameEn(), "utf-8") + "</ITEM_NAMEEN> ";
                } else {
                    requestRegistXml += "<ITEM_NAMEEN>" + encode(odf.getCourse().getNameCh(), "utf-8") + "</ITEM_NAMEEN> ";
                }
                requestRegistXml += "<ITEM_QUALITY>" + odf.getQuantity().intValue() + "</ITEM_QUALITY> ";
                requestRegistXml += "<ITEM_PRICE>" + odf.getPrice() + "</ITEM_PRICE> ";
                requestRegistXml += "<ITEM_AMOUNT>" + odf.getPrice() * odf.getQuantity() + "</ITEM_AMOUNT> ";
                requestRegistXml += "<BUSINESS_CODE>" + odf.getCourse().getBusinessCode() + "</BUSINESS_CODE> ";
                requestRegistXml += "</REQUEST_ITEM> ";
            }
            requestRegistXml += "</REQUEST_ITEMS> ";
        }
        requestRegistXml += "</REQUEST_ORDER>";
        requestRegistXml += "</BODY>";
        requestRegistXml += "</ARAMARK_REQUEST>";

        return requestRegistXml;
    }

    //		/**
//		 * <ARAMARK_RESPONSE>
//		 * 	<HEAD>
//		 * 		<VERSION></VERSION>
//		 * 		<PASSWORD></PASSWORD>
//		 * 		<REQUEST_CUS></REQUEST_CUS>
//		 * 		<REQUEST_TYPE></REQUEST_TYPE>
//		 *  	<PROJECT_CODE></PROJECT_CODE>
//		 *  	<REQUEST_UNIQUE></REQUEST_UNIQUE>
//		 * </HEAD>
//		 * <BODY>
//		 * 		<REQUEST_ORDER>
//		 * 			<CUSTOMER_NO></CUSTOMER_NO>
//		 * 			<CUSTOMER_ACCOUNT_TYPE></CUSTOMER_ACCOUNT_TYPE>
//		 * 			<CUSTOMER_NAME></CUSTOMER_NAME>
//		 * 			<SUBMIT_TIME></SUBMIT_TIME>
//		 * 			<ORDER_CODE></ORDER_CODE>
//		 * 			<ORDER_AMOUNT></ORDER_AMOUNT>
//		 * 			<ORDER_TYPE></ORDER_TYPE>
//		 * 			<ORDER_STATUS></ORDER_STATUS>
//		 * 			<ORDER_PROVIDER></ORDER_PROVIDER>
//		 * 			<PROVIDE_TIME></PROVIDE_TIME>
//		 * 			<ORDER_PRINTER></ORDER_PRINTER>
//		 * 			<PRINT_TIME></PRINT_TIME>
//		 * 			<ORDER_DESTROYER></ORDER_DESTROYER>
//		 * 			<DESTORY_TIME></DESTORY_TIME>
//		 * 			<IS_PAY></IS_PAY>
//		 * 			<REASON></REASON>
//		 * 			<REQUEST_ITEMS>
//		 * 				<REQUEST_ITEM>
//				 * 			<ITEM_CODE></ITEM_CODE>
//				 * 			<ITEM_QUALITY></ITEM_QUALITY>
//				 * 			<ITEM_PRICE></ITEM_PRICE>
//				 * 			<ITEM_AMOUNT></ITEM_AMOUNT>
//			 * 			</REQUEST_ITEM>
//		 * 			</REQUEST_ITEMS>
//		 *
//		 *
//		 *
//		 * 		</REQUEST_ORDER>
//		 *
//		 * </BODY>
//		 * </ARAMARK_RESPONSE>
//		 * @throws UnsupportedEncodingException
//		 * */
//		//-------中汇对接支付接口--------
//		public String  cardPayKongxc(String proPwd,String proName,String schoolCode,MemberBaseInfo mem,String code,String chuzhika_num,String kongxc_SP_CODE) throws UnsupportedEncodingException{
//			String requestRegistXml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
//			requestRegistXml+="<ARAMARK_REQUEST>";
//			requestRegistXml+="<HEAD>";
//			requestRegistXml+="<VERSION>1.0</VERSION>";
//			requestRegistXml+="<PASSWORD>"+proPwd+"</PASSWORD>";
//			requestRegistXml+="<REQUEST_CUS>"+proName+"</REQUEST_CUS>";
//			requestRegistXml+="<REQUEST_TYPE>KONGXC_DD001</REQUEST_TYPE>";
//			requestRegistXml+="<PROJECT_CODE>"+schoolCode+"</PROJECT_CODE>";
//			requestRegistXml+="<REQUEST_UNIQUE>"+UUID.randomUUID().toString().replace("-", "")+"</REQUEST_UNIQUE>";
//			requestRegistXml+="</HEAD>";
//			requestRegistXml+="<BODY>";
//			requestRegistXml+="<REQUEST_ORDER>";
//			requestRegistXml+="<CUSTOMER_NO>"+mem.getIdNumber()+"</CUSTOMER_NO>";
//			requestRegistXml+="<CUSTOMER_ACCOUNT_TYPE>"+chuzhika_num+"</CUSTOMER_ACCOUNT_TYPE>";
//			String name = java.net.URLEncoder.encode(mem.getName(), "utf-8");
//			requestRegistXml+="<CUSTOMER_NAME>"+name+"</CUSTOMER_NAME>";
//			requestRegistXml+="<SUBMIT_TIME>"+TimeTools.calendar2String(mem.getAuditTime(),"yyyy-MM-dd HH:mm:ss")+"</SUBMIT_TIME> "; // 查询日期节点不存在   查询日期不能为空  日期格式错误
//			requestRegistXml+="<ORDER_CODE>"+code+"</ORDER_CODE> ";
//			requestRegistXml+="<ORDER_AMOUNT>"+mem.getAmount()+"</ORDER_AMOUNT> ";
//			requestRegistXml+="<ORDER_TYPE>1</ORDER_TYPE> ";//订单类型，自取，送货上门
//			requestRegistXml+="<ORDER_STATUS>0</ORDER_STATUS> ";//未打印 备餐中 已打印 交易成功 交易失败 已销毁
//			requestRegistXml+="<ORDER_PROVIDER>admin</ORDER_PROVIDER> ";//备餐人
//			requestRegistXml+="<PROVIDE_TIME>"+TimeTools.calendar2String(mem.getAuditTime(), "yyyy-MM-dd HH:mm:ss")+"</PROVIDE_TIME> ";
//			requestRegistXml+="<ORDER_PRINTER>admin</ORDER_PRINTER> ";//订单打印人
//			requestRegistXml+="<PRINT_TIME>"+TimeTools.calendar2String(mem.getAuditTime(), "yyyy-MM-dd HH:mm:ss")+"</PRINT_TIME> ";//订单打印时间
//			requestRegistXml+="<ORDER_DESTROYER>admin</ORDER_DESTROYER> ";//订单撤销人
//			requestRegistXml+="<DESTORY_TIME>"+TimeTools.calendar2String(mem.getAuditTime(),"yyyy-MM-dd HH:mm:ss")+"</DESTORY_TIME> ";//订单撤销时间
//			requestRegistXml+="<IS_PAY>0</IS_PAY>";//是否支付，1已经支付，0未支付
////			-
//			requestRegistXml+="<REASON>"+java.net.URLEncoder.encode("线上订货消费","utf-8")+"</REASON>";
//			System.err.println("=========="+mem.getAmount());
//			Double qua = Double.valueOf(mem.getAmount())/0.01;
//			requestRegistXml+="<REQUEST_ITEMS> ";
//				requestRegistXml+="<REQUEST_ITEM> ";
//				requestRegistXml+="<ITEM_CODE>"+kongxc_SP_CODE+"</ITEM_CODE> ";
//				requestRegistXml+="<ITEM_QUALITY>"+qua.intValue()+"</ITEM_QUALITY> ";		//数量
//				requestRegistXml+="<ITEM_PRICE>0.01</ITEM_PRICE> ";//市场单价
//				requestRegistXml+="<ITEM_AMOUNT>0.01</ITEM_AMOUNT> ";
//				requestRegistXml+="</REQUEST_ITEM> ";
//			requestRegistXml+="</REQUEST_ITEMS> ";
//			requestRegistXml+="</REQUEST_ORDER>";
//			requestRegistXml+="</BODY>";
//			requestRegistXml+="</ARAMARK_REQUEST>";
//
//			return requestRegistXml;
//		}
//
//		public String resolveOrderInfo(String requestRegistInfoXml){
//			String errorCode = "9999";
//			try {
//				Document doc = DocumentHelper.parseText(requestRegistInfoXml);
//				Element rootment = doc.getRootElement();// 获取根节点
//				if (null == rootment || !rootment.getName().equals("ARAMARK_RESPONSE")) {
//					return  errorCode;
//				}else{
//					Element head = rootment.element("HEAD");
//					if(head == null ) return errorCode;
//
//					Element RESPONSE_ELEMENT = head.element("RESPONSE_CODE");
//					if(RESPONSE_ELEMENT == null) return errorCode;
//
//					if("0000".equals(RESPONSE_ELEMENT.getTextTrim())){
//						Element BODY  = rootment.element("BODY");
//						if(BODY == null) return errorCode;
//
//						Element RESULT = BODY.element("RESULT");
//						if(RESULT == null || "9999".equals(RESULT)) return errorCode;
//
//						return RESULT.getTextTrim();
//
//					}else{
//						return errorCode;
//					}
//				}
//			} catch (DocumentException e) {
//				e.printStackTrace();
//				return errorCode;
//			}
//		}
//
//
//		/**
//		 * 解析二次请求返回的xml,判断请求是否成功（扣款部分）
//		 * @param responseXml
//		 * @param request
//		 * @return
//		 */
    public String responseDesc(String responseXml, HttpServletRequest request) {

        String errorCode = "9999";
        try {
            Document doc = DocumentHelper.parseText(responseXml);
            Element rootment = doc.getRootElement();// 获取根节点
            if (null == rootment || !"ARAMARK_RESPONSE".equals(rootment.getName())) {
                return errorCode;
            } else {
                Element head = rootment.element("HEAD");
                if (head == null) {
                    return errorCode;
                }
                Element RESPONSE_DESC = head.element("RESPONSE_DESC");
                if (RESPONSE_DESC == null) {
                    return errorCode;
                }
                return RESPONSE_DESC.getTextTrim();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "9999";
    }
//
//		/*<?xml version="1.0" encoding="UTF-8"?>
//		<ARAMARK_RESPONSE>
//			<HEAD>
//				<VERSION>1.0</VERSION>
//				<REQUEST_CUS>OL</REQUEST_CUS>
//				<REQUEST_TYPE>KONGXC_AC001</REQUEST_TYPE>
//				<PROJECT_CODE>1234567</PROJECT_CODE>
//				<REQUEST_UNIQUE>edc51c3ca3ca4fc8b4737c3f204dc31e</REQUEST_UNIQUE>
//				<RESPONSE_CODE>0000</RESPONSE_CODE>
//				<RESPONSE_DESC>成功</RESPONSE_DESC>
//				<RESPONSE_TIME>2017-08-10 14:42:38</RESPONSE_TIME>
//			</HEAD>
//			<BODY>
//				<CARD_ACCOUNT>
//				<ACCOUNT_ID>1</ACCOUNT_ID>
//				<ACCOUNT_NO>ZH001</ACCOUNT_NO>
//				<ACCOUNT_TYPE>04</ACCOUNT_TYPE>
//				<CUSTOMER_NAME>孔祥超</CUSTOMER_NAME>
//				<CUSTOMER_MALE>男</CUSTOMER_MALE>
//				<AMOUNT>98.0</AMOUNT>
//				<TIMES>0</TIMES>
//				<STATUS>0</STATUS>
//				</CARD_ACCOUNT>
//			</BODY>
//			</ARAMARK_RESPONSE>*/

}
